Under construction

Still being built. Things may change

Calvinball minimum teams

Time limit1sMemory limit256 MB

Summary
Split up to 20 players into the fewest teams with no disliking pair together, breaking ties lexicographically.
Level

Medium7 of 10

Topics
Backtracking, Graph, Bit manipulation
Solved
No attempts yet

Problem

The Calvinball world championship is held in the Czech Republic again this year. One game is played by n players with distinct names, and the players are split into some number of non-empty teams. Some players dislike each other. Disliking is symmetric: if player a dislikes player b, then b also dislikes a.

The International Calvinball Disorganization changed the team selection rule. Two players who dislike each other may not be on the same team, and subject to that, the number of teams must be as small as possible.

Suppose Calvin, Hobbes, Susie, Tom, Jerry, and Batman play. Batman dislikes the other five, and Tom dislikes Jerry and Hobbes. Three teams are enough here: Batman alone, Tom with Susie, and Calvin with Hobbes and Jerry. Two teams are not enough, because Batman, Tom, and Jerry all dislike each other and must go to three different teams.

Given every pair of players who dislike each other, split the players into teams. Several splits can satisfy the rule, so the output section fixes which one to print.

Input

The first line contains the number of players n and the number of disliking pairs m, separated by a space (0≤n≤200 \le n \le 20, 0≤m≤n(n−1)/20 \le m \le n(n-1)/2). Players are numbered from 1 to n.

Each of the next m lines contains the numbers aia_i and bib_i of two players who dislike each other (1≤ai,bi≤n1 \le a_i, b_i \le n, ai≠bia_i \ne b_i). No pair is given twice, and a pair is never repeated with its two numbers swapped.

Output

Print the minimum number of teams t on the first line. On each of the next t lines, print the numbers of the players on that team in increasing order, separated by spaces.

When several splits use t teams, print the one this rule picks. Let cvc_v be the number of the team that player v belongs to. Among all splits into t teams, print the one whose sequence (c1,c2,…,cn)(c_1, c_2, \dots, c_n) is lexicographically smallest. Under this rule the smallest player number on team i grows as i grows.

If n is 0, print only 0 on the first line and print no team lines.

Examples3

  1. Example 1

    Input
    6 7
    1 6
    2 6
    3 6
    4 6
    5 6
    5 4
    2 4
    
    Expected output
    3
    1 2 3 5
    4
    6
  2. Example 2

    Input
    3 3
    1 2
    2 3
    1 3
    
    Expected output
    3
    1
    2
    3
  3. Example 3

    Input
    4 3
    1 2
    2 3
    3 4
    
    Expected output
    2
    1 3
    2 4