Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIFLIP - Flipping cells

Given a 3 x 3 square with some white and 1 black squares. When clicking on a cell, that cell and the cells with the same edge will change color from white to black and vice versa. Given a 3 x 3 square, ask for the minimum number of taps to turn the all-white square into the given square.

Visualization: https://drive.google.com/file/d/1G_Wz_FwDaV1me5f6m9JFSoLX9LUcCF-U/view?usp=drive_link

Input

The first line is the number of testcases

Each testcase consists of 3 lines, each line is 3 characters representing the color of 3 cells in that line where '*' is black, '.' is white

Output

The minimum number of steps of each testcase on 1 line

Example

Input:
2
*..
**.
*..
***
*..
..*

Output:
1
3


Added by:Ha Minh Ngoc
Date:2019-04-22
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.