atcoder#JSC2019QUALD. Classified

Classified

Score: 600600 points

Problem Statement

AtCoder's head office consists of NN rooms numbered 11 to NN. For any two rooms, there is a direct passage connecting these rooms.

For security reasons, Takahashi the president asked you to set a level for every passage, which is a positive integer and must satisfy the following condition:

  • For each room i (1iN)i\ (1 \leq i \leq N), if we leave Room ii, pass through some passages whose levels are all equal and get back to Room ii, the number of times we pass through a passage is always even.

Your task is to set levels to the passages so that the highest level of a passage is minimized.

Constraints

  • NN is an integer between 22 and 500500 (inclusive).

Input

Input is given from Standard Input in the following format:

NN

Output

Print one way to set levels to the passages so that the objective is achieved, as follows:

a1,2a_{1,2} a1,3a_{1,3} ...... a1,Na_{1,N}

a2,3a_{2,3} ...... a2,Na_{2,N}

..

..

..

aN1,Na_{N-1,N}

Here ai,ja_{i,j} is the level of the passage connecting Room ii and Room jj.

If there are multiple solutions, any of them will be accepted.

3
1 2
1

The following image describes this output:

For example, if we leave Room 22, traverse the path 23232122 \to 3 \to 2 \to 3 \to 2 \to 1 \to 2 while only passing passages of level 11 and get back to Room 22, we pass through a passage six times.