ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

2222. Сavalry Battle Advanced

Time limit: 1.0 second
Memory limit: 256 MB
Recently, Vadim wrote his game, which he called “Cavalry Battle Advanced.” This game is somewhat reminiscent of chess but differs in some important aspects:
  1. In “Cavalry Battle Advanced,” there is only one piece — the chess knight. This piece moves in an “L” shape in all directions, moving 2 squares along one axis and 1 square along another. If there is another piece on the square to which the knight can move in one turn, the knight captures that piece.
  2. The initial arrangement of pieces from one player’s side occurs on a board of size 3 × N. You can place as many knights as you want, but only within this board.
To prevent players from filling the entire available 3 × N board with knights, Vadim encoded a secret bonus. To understand it better, let’s imagine a graph where each placed knight is a vertex, and if a pair of knights can capture each other, there is an edge between the corresponding vertices in the graph. The bonus is added only if this graph is a tree (i.e., the graph is connected and acyclic).
It is clear that all professional players of “Cavalry Battle Advanced” want to both obtain this secret bonus and place the maximum possible number of knights on the designated board. Take on the role of these players and find such an arrangement.

Input

A single line contains an integer N — the size of the board horizontally (1 ≤ N ≤ 105).

Output

Output the arrangement in the following format: 3 lines of N numbers 0 or 1 — 0 if the cell is empty, and 1 if there is a knight in the cell. Thus, you will get a table of size 3 × N. All knights must form a tree as described in the conditions.
If there are multiple suitable arrangements with the maximum number of knights, output any of them.

Samples

inputoutput
3
0 1 1
1 0 1
1 1 1
2
1 0
0 0
0 1
Problem Author: Vadim Barinov
Problem Source: ICPC Ural Regional Contest Qualifier 2025