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

1970. 皇后像廣場

Time limit: 1.0 second
Memory limit: 64 MB
Vova was walking along the Statue Square (皇后像廣場) in Hong Kong, when he noticed that the square was paved with multi-colored square tiles. Vova took a careful look at the tiles and realized that they formed some picture. The tiles were large and he couldn't look at all of them at once. Probably one should look at the tile picture from above.
Vova decided to take a photo of a (10 × 10)-tile part of a picture, but he still couldn't cover them with one shot. Then Vova took nine photos, each of them covered a (4 × 4)-tile area of the picture (see the picture below). If we arrange the nine photos correctly, then we can restore the original 10 × 10 picture.
Problem illustration
Unfortunately, soon after printing out the photos Vova forgot not only the arranging order of them, but the correct rotation as well. He can rotate the image on the photo by an arbitrary angle multiple of 90 degrees. Help Vova use the nine photos to restore the original 10 × 10 pattern.

Input

The input contains the nine photos Vova made. The photos are described by 4 × 4 size matrices containing integers from 0 to 99, representing the colors of the corresponding tiles. The numbers on a line are separated by spaces. Each matrix is separated from the next one by an empty line.

Output

Print the original pattern as a 10 × 10 matrix. The matrix elements in the line should be separated by spaces. If there are multiple solutions, you may print any of them. It is guaranteed that at least one solution exists.

Sample

inputoutput
1 1 9 9
1 9 1 1
9 1 1 1
9 1 1 9

9 1 1 9
9 1 1 1
9 1 1 1
9 1 1 9

9 1 1 9
9 1 1 1
1 9 1 1
1 1 9 9

9 1 1 9
1 1 1 1
1 1 1 1
9 1 1 9

9 1 1 9
1 1 1 9
1 1 9 1
9 9 1 1

9 1 1 9
1 1 1 9
1 1 1 9
9 1 1 9

9 9 1 1
1 1 9 1
1 1 1 9
9 1 1 9

9 9 9 9
1 1 1 1
1 1 1 1
9 1 1 9

9 1 1 9
1 9 9 1
1 1 1 1
9 9 9 9
1 1 9 9 9 9 9 9 1 1
1 9 1 1 1 1 1 1 9 1
9 1 1 1 1 1 1 1 1 9
9 1 1 9 1 1 9 1 1 9
9 1 1 1 1 1 1 1 1 9
9 1 1 1 1 1 1 1 1 9
9 1 1 9 1 1 9 1 1 9
9 1 1 1 9 9 1 1 1 9
1 9 1 1 1 1 1 1 9 1
1 1 9 9 9 9 9 9 1 1
Problem Source: Open Ural FU Personal Contest 2013