You are given the following dice puzzle.
For each plausible arrangement, look at the right side of the cube and add the nine numbers that appear there. Your task is to report every possible value of this right-side sum.
The first line contains an integer $N$, the number of datasets. The $N$ datasets follow.
Each dataset consists of six lines. The first three lines describe the top view of the cube as a $3 \times 3$ grid
T11 T12 T13
T21 T22 T23
T31 T32 T33
and the next three lines describe the front view as a $3 \times 3$ grid in the same layout
F11 F12 F13
F21 F22 F23
F31 F32 F33
Each $T_{ij}$ and $F_{ij}$ is either the number on that face (an integer from $1$ to $6$) or $0$, which means the face is unknown. The values in a line are separated by spaces.
Number the columns of both grids $1$ to $3$ from left to right. The cube splits into three vertical layers, one per column, and the $j$-th column of the top view and the $j$-th column of the front view describe the same layer. Such a layer holds nine dice, indexed by depth (front to back) and by height (bottom to top). The three entries of that top-view column list the layer's top faces, one per depth; the three entries of that front-view column list the layer's front faces, one per height. Consequently the die at a given depth and height in the layer shows the top face of that depth and the front face of that height.
For each dataset, consider every plausible arrangement and compute, for each of them, the sum of the nine faces $R_{ij}$ on the right side of the cube (numbered like the other views), that is $\sum_{i=1}^{3}\sum_{j=1}^{3} R_{ij}$.
Print one line per dataset containing all the distinct right-side sums in ascending order, separated by a single space. If the dataset has no plausible arrangement, print a single $0$. The output is compared exactly, so do not print any trailing spaces at the end of a line.