You are given a 3x3 board. Each square starts out white or black. When you click a square, that square and the squares next to it to the north, south, east, and west (the ones that exist on the board) flip color: white becomes black, and black becomes white.
You want to turn an all-white 3x3 board into the board given in the input. You cannot rotate the board.
The first line has the number of test cases P (0<P≤50).
Each test case is three lines of three characters. * means black and . means white.
For each test case, print the minimum number of clicks needed to turn the all-white board into the board given in the input, one answer per line.