L. We Luv Stamina
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

No, we don't luv stamina; we luv jumptrills!

After being tortured by three hours of handstream practice, the desperate XW is begging you to write a program that converts a given stream chart into a purely jumptrills chart.

Let's describe your task in formal terms. Note that some definitions in this problem may differ from those used in real 4-key rhythm games.

A chart is an $$$n \times 4$$$ binary matrix. Let $$$c_{i,j}$$$ denote the element in the $$$i$$$-th row and $$$j$$$-th column. Here, $$$c_{i,j} = 1$$$ means there is a note at that position, and $$$c_{i,j} = 0$$$ means it is empty. The given chart is guaranteed to satisfy that no column has two consecutive notes, i.e. for all $$$1 \lt i \leq n$$$ and $$$1 \leq j \leq 4$$$, we have $$$c_{i-1,j} \times c_{i,j} = 0$$$.

While playing the chart, you hit notes in columns 1 and 2 with your left hand, and notes in columns 3 and 4 with your right hand. To make the chart more playable, XW wants to ensure that no hand is required to hit notes in two consecutive rows. To achieve this, he needs you to perform the following operation:

  • Check all rows in reverse order: from row $$$n-1$$$ down to row $$$1$$$.
  • For the current row $$$i$$$:
    • If row $$$i+1$$$ has a note in column 1 or 2, and row $$$i$$$ also has a note in column 1 or 2, then move the note in row $$$i$$$ down by one row. (It can be proven that in this case, there is only one such note and the position below it is empty.)
    • Similarly, if row $$$i+1$$$ has a note in column 3 or 4, and row $$$i$$$ also has a note in column 3 or 4, move that note in row $$$i$$$ down by one row.

After applying the above transformation, the chart will be converted from a terrifying dense handstream chart into a friendly jumptrills chart. But XW doesn't know how to implement it. Can you help him?

Reading the sample might help you better understand the task.

Input

The first line contains a single integer $$$n$$$ $$$(1 \leq n \leq 10^3)$$$, denoting the number of rows in the chart.

The next $$$n$$$ lines each contain $$$4$$$ binary digits, denoting whether a note exists in each of the 4 columns of the $$$i$$$-th row.

It's guaranteed that no column has two consecutive '$$$1$$$'.

Output

Output $$$n$$$ lines. Each line should contain $$$4$$$ binary digits denoting the modified chart. Do not output any extra spaces or blank lines.

Examples
Input
4
1011
0100
1001
0010
Output
1011
0000
1100
0011
Input
20
0011
0100
1001
0010
0100
1000
0110
0001
1010
0100
0011
1100
0011
0100
0011
1100
0011
0100
1010
0001
Output
0011
0000
1100
0011
0100
0000
1110
0000
0011
1100
0011
1100
0011
0100
0011
1100
0011
0000
1100
0011
Note

For the first sample case:

In row $$$3$$$, both the left hand (column $$$1$$$) and the right hand (column $$$4$$$) are used. Since row $$$4$$$ had right-hand usage (column $$$3$$$), so the note in column $$$4$$$ is moved down to row $$$4$$$ .

In row $$$2$$$, the left hand (column $$$1$$$) is also used, so the note in column $$$1$$$ is moved down to row $$$3$$$ .

In row $$$1$$$, both hands are used again. But since no hand is used in row $$$2$$$ (Note that the original note in row $$$2$$$ has already been moved to row $$$3$$$), so the notes in row 1 weren't moved.

After these operations, no hand is used in two consecutive rows.