Farmer John was marching 19 of his finest black Angus and white Jersey cows to market the other day when his wife, Farmeress Joanne, noticed that all 16 possible combinations of four successive black and white cows (e.g., bbbb, bbbw, bbwb, bbww, ..., wwww) were present (as contiguous cow-subsequences) as the parade passed by. Of course, some of the combinations overlapped others.
Your job is to find an ordering of N cows so that each of the possible sequences of C colors can be found as a contiguous 'subsequence' of cows. Typical lengths and subsequences are: 2,5; 3,10; 4,19; 5,36 and others. Each input dataset is guaranteed to have a solution.
A single line with two integers:
The output is N lines, each with a single 'b' or 'w'. The lines represent a possible ordering of the parading cows.