#SDNU1305. Hamming Codes

Hamming Codes

Description

Given NN, BB, and DD: Find a set of NN codewords (1N641\le N\le 64), each of length BB bits (1B81\le B\le 8), such that each of the codewords is at least Hamming distance of DD (1D71\le D\le 7) away from each of the other codewords. The Hamming distance between a pair of codewords is the number of binary bits that differ in their binary notation. Consider the two codewords 0x554 and 0x234 and their differences (0x554 means the hexadecimal number with hex digits 55, 55, and 44):

                0x554 = 0101 0101 0100 
                0x234 = 0010 0011 0100
Bit differences:         xxx  xx

Since five bits were different, the Hamming distance is 55.

Format

Input

NN, BB, DD on a single line

Output

NN codewords, sorted, in decimal, ten per line. In the case of multiple solutions, your program should output the solution which, if interpreted as a base 2B2^B integer, would have the least value.

Samples

16 7 3
0 7 25 30 42 45 51 52 75 76
82 85 97 102 120 127