A snake fills a 3×n board with no empty squares. The snake's squares are numbered from 1 to 3n in order. Squares with consecutive numbers (1 and 2, 2 and 3, 3 and 4, …) share an edge.
A snake can fill a 3×9 board as follows, for example.

Some of the numbers have been erased. Reconstruct the snake.
The first line contains a single integer n (1≤n≤1000), the length of the board.
The next three lines describe the board. The i-th of these lines contains n integers aij (0≤aij≤3n for 1≤j≤n).
If aij>0, then aij is the number of the snake segment on the j-th square of the i-th row. If aij=0, the number on that square is unknown.
Print three lines. The i-th line should contain n positive integers bij (for 1≤j≤n), separated by spaces. Together, the numbers bij must be a permutation of 1,2,…,3n.
The output must agree with every positive number in the input, and squares that hold consecutive numbers must share an edge.
A valid reconstruction always exists, and it is unique.