Raju remembers his childhood days and it reminds him of his favourite game 'Find the pattern'. He memorizes that there is a problem pattern and there are four options available. He had to choose the correct pattern from the options that fits correctly with the problem pattern and when both are merged together they form a square. Also, that game contains difficult problems in which first he has to rotate the problem pattern and then find the correct option.
Given a problem pattern and four options, find the correct option that fits exactly with the problem pattern and forms a square of 10 × 10. The problem pattern can be rotated through 90 degrees, 180 degrees or 270 degrees as required.
Note: All the patterns contains characters 'X' and '_'.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. Each test case contains five patterns of size 10 × 10 characters.There is a blank line after each pattern. The first pattern is the problem pattern and the next four patterns are options to the solution. One of these four patterns is the solution to the first pattern.
Output
For each test case print the relative position of the correct option from the problem pattern.
Constraints
1<=T<=100