Children's Dining
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 4564 Accepted: 694 Special Judge
Description
Usually children in kindergarten like to quarrel with each other. This situation annoys the child-care women. For instant, when diner time comes, a fierce conflict may break out when a certain couple of children sitting side by side who are hostile with each other. Although there aren't too many children dining atthe same round table, butthe relationship of"enemy"or"friend" may be very complex. The child-care women do come across a big problem. Now itistimefor you to help them to figure out a proper arrangement of sitting, with which no two "enemy" children is adjacent.
Now we assume that there are 2 * n children who sit around a big table, andthat none has more than n - 1"enemies".
Input
The input is consisted of several test blocks. For each block, thefirst line contains two integers n and m (1 <= n <= 200, 0 <= m <= n (n - 1)). We use positive integers from1to2 * n to label the children dining round table. Then m lines followed. Each contains positive integers i and j ( i isnotequalto j, 1 <= i, j <= 2 * n), which indicate that child i and child j consider each other as"enemy". In a input block, a same relationship isn'tgiven more than once, which means thatif"i j" has been given, "j i" will not be given.
There will be a blank line between input blocks. And m = n = 0 indicates theendof input and this case shouldn't be processed.
Output
For each test block, ifthe proper arrangement exist, you should print a line with a proper one; otherwise, print a line with"No solution!".
Sample Input
102212343612132435465641212131425263738484756576800
Sample Output
12423116325416723458
Source
POJ Monthly,anonymous