Statement
Statement language
binary strings of length are given. Construct one binary grid.
A path is a sequence of distinct cells such that every pair of consecutive cells shares a side.
Every given string must appear along at least one path of length in the constructed grid. Print the grid and one corresponding path for each string.
Input
The input is given in the following format:
Each case is given in the following format:
Output
For each test case, first print the constructed binary grid in lines.
Then, for in order, print integers on one line. These are the cells of a path spelling , in order.
If there are multiple solutions, print any of them.
Constraints
- is a binary string of length .
- The sum of over all test cases does not exceed .
Subtasks
Samples
Input
1
2 4
00
01
10
11
Output
00
11
1 1 1 2
1 1 2 1
2 1 1 1
2 1 2 2