223. Tiles

p9.png
p223-sample

Sample input

8 4


Sample output

1 4 44 3 51 3 32 5 34 2 63 3 74 1 71 1 51 2 24 1 31 1 12 3 12 6 23 7 32 7 11 5 1