459. Choreographer Problem

Time limit per test: 0.75 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard

As you probably know, choreography is the art of making dances. But it is not a so well-known fact that it is also the science of making dances.

There are n dancers numbered from 1 to n in the dance troupe, and all of them are working hard to create a new original dance. Before the dance starts each dancer puts on his special hand-made costume, and he has to wear this costume for the duration of the entire dance.

It is known that the costume of i-th dancer is similar to the costumes of (i-1)-th and (i+1)-th dancers (therefore the dancers are similar too), but at the same time, i-th dancer is not similar to any other dancer. Therefore, (i-1)-th and (i+1)-th dancers are not similar. If n > 1, then the first dancer has the only similar dancer, the last dancer has the only similar dancer, and all other dancers have exactly two similar dancers.

The dance starts and ends with an empty stage. The stage should not be empty during the dance. Each minute one of the following changes happens on the stage:

At every moment of time the stage must not have more than k dancers, because spectators may lose attention if there are too many dancers on the stage.

Now choreographer is thinking about arranging the dance in such a way that each set of the dancers containing no more than k dancers appears on the stage exactly once. Your job is to write a program to help the choreographer.

The first line contains two positive integer numbers n,k (1 ≤ n ≤ 20; 1 ≤ kn).

Print the only line describing the dance. The substring
i means that the i-th dancer appears on the stage, the substring
i means that the i-th dancer leaves the stage. The substring
i means that the i-th dancer leaves while the similar (i+1)-th dancer appears, and
i means that the i-th dancer leaves while the similar (i-1)-th dancer appears. The output will be processed from the left to the right.

If there are many solutions, you may output any of them. If there is no solution, print 0 to the only line of output.

sample input
sample output
2 1

Online Contester Team © 2002 - 2010. All rights reserved.