atcoder#JSC2019QUALD. Classified
Classified
Score: points
Problem Statement
AtCoder's head office consists of rooms numbered to . 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 , if we leave Room , pass through some passages whose levels are all equal and get back to Room , 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
- is an integer between and (inclusive).
Input
Input is given from Standard Input in the following format:
Output
Print one way to set levels to the passages so that the objective is achieved, as follows:
Here is the level of the passage connecting Room and Room .
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 , traverse the path while only passing passages of level and get back to Room , we pass through a passage six times.