#include<bits/stdc++.h>
using namespace std;
char s[10][10];
int z[10][10];
int n;
int paallac, edessac, takanac, alhaallac, vasemmallac, oikeallac;
int main(){
cin >> n;
int countteri = 0;
for(int ss = 0; ss < n; ss++){
for(int i = 1; i <= 5; i++){
for(int j = 1; j <= 5; j++){
cin >> s[i][j];
}
}
for(int i = 0; i <= 6; i++){
s[i][0] = '.';
s[0][i] = '.';
s[i][6] = '.';
s[6][i] = '.';
}
for(int i = 0; i <= 6; i++){
for(int j = 0; j <= 6; j++){
cout << s[i][j];
}
cout << "\n";
}
int x,y;
for(int i = 1; i <= 5; i++){
for(int j = 1; j <= 5; j++){
if(s[i][j] != '.'){
int a = 0;
a += s[i-1][j] != '.';
a += s[i+1][j] != '.';
a += s[i][j+1] != '.';
a += s[i][j-1] != '.';
if( a >= 3){
y = i;
x = j;
}
}
}
}
// cout << y << " " << x << "\n";
int a = 0;
int b = 0;
if(s[y-1][x] != '.' && s[y+1][x] != '.' && s[y][x-1]!= '.' && s[y][x+1] != '.'){
a++;
// NELJÄLLÄ PUOLELLA
if(s[y-2][x] != '.'){
/* .
.
...
.
*/
paallac = s[y-2][x];
edessac = s[y-1][x];
takanac = s[y+1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.
...
.
.
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
/*
.
....
.
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x-2] != '.'){
/*
.
....
.
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}
}
else if(s[y-1][x] != '.' && s[y+1][x] != '.' && s[y][x-1] != '.'){
a++;
// YLHÄÄLLÄ, ALHAALLA, VASEMMALLA
/*
.....
..1..
.1A..
..1..
.....
*/
if(s[y-1][x+1] != '.'){
/*
.....
..11.
.1A..
..1..
.....
*/
if(s[y+2][x] != '.'){
/*
.....
..11.
.1A..
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y-2][x+1] != '.'){
/*
...1.
..11.
.1A..
..1..
.....
*/
paallac = s[y-2][x+1];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y-1][x+1] != '.'){
}else if(s[y][x-2] != '.'){
/*
.....
..11.
11A..
..1..
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y-2][x] != '.'){
/*
..1..
..11.
.1A..
..1..
.....
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A..
..11.
.....
*/
if(s[y+1][x+2] != '.'){
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
.1A..
..11.
...1.
*/
paallac = s[y+1][x+1];
edessac = s[y+1][x];
takanac = s[y][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+2][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.....
..1..
.1A..
..11.
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A..
..11.
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
..1..
..1..
.1A..
..11.
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}
}
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A..
..1..
.....
*/
if(s[y-2][x+1] != '.'){
/*
..11.
..1..
.1A..
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-2][x+1];
b++;
}else if(s[y-1][x+1]!= '.'){
/*
..1..
..11.
.1A..
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y][x+1] != '.'){
/*
..1..
..1..
.1A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x+1] != '.'){
/*
..1..
..1..
.1A..
..11.
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y+2][x] != '.'){
}else if(s[y][x-2] != '.'){
}
}else if(s[y+2][x] != '.'){
/*
.....
..1..
.1A..
..1..
..1..
*/
if(s[y-2][x] != '.'){
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
.1A..
..1..
..11.
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+2][x+1];
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A..
..11.
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y][x+1] != '.'){
/*
.....
..1..
.1A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
..11.
.1A..
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x];
b++;
}else if(s[y][x-2] != '.'){
}
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A..
..1..
.....
*/
if(s[y-2][x] != '.'){
}else if(s[y-1][x+1] != '.'){
/*
.....
..11.
11A..
..1..
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y][x+1] != '.'){
/*
.....
..1..
11A1.
..1..
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
11A..
..11.
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
}else if(s[y][x-3] != '.'){
}
}
}else if(s[y-1][x] != '.' && s[y+1][x] != '.' && s[y][x+1] != '.'){
/*
.....
..1..
..A1.
..1..
.....
*/
if(s[y-1][x-1] != '.'){
/*
.....
.11..
..A1.
..1..
.....
*/
if(s[y-1][x-2] != '.'){
}else if(s[y-2][x-1] != '.'){
/*
.1...
.11..
..A1.
..1..
.....
*/
paallac = s[y-2][x-1];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-2][x] != '.'){
/*
..1..
.11..
..A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
/*
.....
.11..
..A11
..1..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.11..
..A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
..A1.
.11..
.....
*/
if(s[y-1][x] != '.'){
/*
..1..
..1..
..A1.
.11..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
/*
.....
..1..
..A11
.11..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.....
..1..
..A1.
.11..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
..A1.
.11..
.1...
*/
paallac = s[y+2][x-1];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x+2] != '.'){
}
}else if(s[y][x+2] != '.'){
/*
.....
..1..
..A11
..1..
.....
*/
if(s[y-2][x] != '.'){
}else if(s[y-1][x-1] != '.'){
/*
.....
.11..
..A11
..1..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
..A11
.11..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+3] != '.'){
/*
......
..1...
..A111
..1...
......
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x+3];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
}else if(s[y][x-1] != '.'){
/*
.....
..1..
.1A11
..1..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}
}else if(s[y+2][x] != '.'){
/*
.....
..1..
..A1.
..1..
..1..
*/
if(s[y+2][x-1] != '.'){
/*
.....
..1..
..A1.
..1..
.11..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+2][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
..A1.
.11..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x-1]!= '.'){
/*
.....
..1..
.1A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-1][x-1] != '.'){
/*
.....
.11..
..A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2]!= '.'){
}
}else if(s[y-2][x] != '.'){
/*
..1..
..1..
..A1.
..1..
.....
*/
if(s[y-2][x-1] != '.'){
/*
.11..
..1..
..A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-2][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-1][x-1] != '.'){
/*
..1..
.11..
..A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x-1] != '.'){
/*
..1..
..1..
.1A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
..1..
..1..
..A1.
.11..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
}
}
}
else if(s[y-1][x] != '.' && s[y][x-1] != '.' && s[y][x+1] != '.'){
a++;
// YLHÄÄLLÄ; VASEMMALLA; OIKEALLA
/*
.....
..1..
.1A1.
.....
.....
*/
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A1.
.....
.....
*/
if(s[y-3][x] != '.'){
/*
..1..
..1..
..1..
.1A1.
.....
.....
*/
paallac = s[y-2][x];
edessac = s[y-3][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
}else if(s[y][x-2] != '.'){
}else if(s[y+1][x+1] != '.'){
/*
..1..
..1..
.1A1.
...1.
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x+1];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
..1..
..1..
.1A1.
.1...
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x-1];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A1.
.....
.....
*/
if(s[y-2][x] != '.'){
}else if(s[y+1][x-2] != '.'){
/*
.....
..1..
11A1.
1....
.....
*/
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
11A1.
.1...
.....
*/
b++;
}else if(s[y+1][x] != '.'){
/*
.....
..1..
11A1.
..1..
.....
*/
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
11A1.
...1.
.....
*/
b++;
}
}else if(s[y][x+2] != '.'){
/*
.....
..1..
.1A11
.....
.....
*/
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A11
.....
.....
*/
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
.1A11
.1...
.....
*/
b++;
}else if(s[y+1][x] != '.'){
/*
.....
..1..
.1A11
..1..
.....
*/
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A11
...1.
.....
*/
b++;
}else if(s[y+1][x+2] != '.'){
/*
.....
..1..
.1A11
.....
.....
*/
b++;
}
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A1.
...1.
.....
*/
b++;
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A1.
...1.
.....
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A1.
...1.
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
..1..
.1A11
...1.
.....
*/
b++;
}else if(s[y+1][x+2] != '.'){
/*
.....
..1..
.1A1.
...11
.....
*/
b++;
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
.1A1.
...1.
...1.
*/
b++;
}
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
.1A1.
.1...
.....
*/
if(s[y][x-2] != '.'){
/*
.....
..1..
11A1.
.1...
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
..1..
.1A11
.1...
.....
*/
b++;
}else if(s[y+1][x-2] != '.'){
/*
.....
..1..
.1A1.
11...
.....
*/
b++;
}else if(s[y+2][x-1] != '.'){
/*
.....
..1..
.1A1.
.1...
.1...
*/
b++;
}else if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A1.
.1...
.....
*/
b++;
}
}
}
else if(s[y+1][x] != '.' && s[y][x-1] != '.' && s[y][x+1] != '.'){
a++;
// ALHAALLA VASEMMALLA OIKEALLA
/*
.....
.....
.1A1.
..1..
.....
*/
if(s[y+2][x] != '.'){
/*
.....
.....
.1A1.
..1..
..1..
*/
if(s[y-1][x] != '.'){
/*
.....
..1..
.1A1.
..1..
..1..
*/
b++;
}else if(s[y-1][x-1] != '.'){
/*
.....
.1...
.1A1.
..1..
..1..
*/
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
.1A1.
..1..
..1..
*/
b++;
}else if(s[y+3][x] != '.'){
/*
.....
.....
.1A1.
..1..
..1..
..1..
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
.....
11A1.
..1..
..1..
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
.....
.1A11
..1..
..1..
*/
b++;
}
}else if(s[y][x-2] != '.'){
/*
.....
.....
11A1.
..1..
.....
*/
if(s[y-1][x-2] != '.'){
/*
.....
1....
11A1.
..1..
.....
*/
b++;
}else if(s[y-1][x-1] != '.'){
/*
.....
.1...
11A1.
..1..
.....
*/
b++;
}else if(s[y-1][x] != '.'){
/*
.....
..1..
11A1.
..1..
.....
*/
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
11A1.
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.....
11A1.
..1..
..1..
*/
b++;
}
}else if(s[y][x+2] != '.'){
/*
.....
.....
.1A11
..1..
.....
*/
if(s[y-1][x-1] != '.'){
/*
.....
.1...
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x] != '.'){
/*
.....
..1..
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x+2] != '.'){
/*
.....
....1
.1A11
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.....
.1A11
..1..
..1..
*/
b++;
}
}else if(s[y-1][x-1] != '.'){
/*
.....
.1...
.1A1.
..1..
.....
*/
if(s[y-2][x-1] != '.'){
/*
.1...
.1...
.1A1.
..1..
.....
*/
b++;
}else if(s[y-1][x-2] != '.'){
/*
.....
11...
.1A1.
..1..
.....
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
.1...
11A1.
..1..
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
.1...
.1A11
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.1...
.1A1.
..1..
..1..
*/
b++;
}
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
.1A1.
..1..
.....
*/
if(s[y-2][x+1] != '.'){
/*
...1.
...1.
.1A1.
..1..
.....
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
...1.
11A1.
..1..
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
...1.
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x+2] != '.'){
/*
.....
...11
.1A1.
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
...1.
.1A1.
..1..
..1..
*/
b++;
}
}
}
if(b == 1){
countteri++;
}
}
if(countteri){
return 1;
}else{
cout << "vaarin\n";
}
}
#include<bits/stdc++.h>
using namespace std;
char s[10][10];
int z[10][10];
int n;
int paallac, edessac, takanac, alhaallac, vasemmallac, oikeallac;
int main(){
cin >> n;
int countteri = 0;
for(int ss = 0; ss < n; ss++){
for(int i = 1; i <= 5; i++){
for(int j = 1; j <= 5; j++){
cin >> s[i][j];
}
}
for(int i = 0; i <= 6; i++){
s[i][0] = '.';
s[0][i] = '.';
s[i][6] = '.';
s[6][i] = '.';
}
for(int i = 0; i <= 6; i++){
for(int j = 0; j <= 6; j++){
cout << s[i][j];
}
cout << "\n";
}
int x,y;
for(int i = 1; i <= 5; i++){
for(int j = 1; j <= 5; j++){
if(s[i][j] != '.'){
int a = 0;
a += s[i-1][j] != '.';
a += s[i+1][j] != '.';
a += s[i][j+1] != '.';
a += s[i][j-1] != '.';
if( a >= 3){
y = i;
x = j;
}
}
}
}
// cout << y << " " << x << "\n";
int a = 0;
int b = 0;
if(s[y-1][x] != '.' && s[y+1][x] != '.' && s[y][x-1]!= '.' && s[y][x+1] != '.'){
a++;
// NELJÄLLÄ PUOLELLA
if(s[y-2][x] != '.'){
/* .
.
...
.
*/
paallac = s[y-2][x];
edessac = s[y-1][x];
takanac = s[y+1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.
...
.
.
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
/*
.
....
.
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x-2] != '.'){
/*
.
....
.
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}
}
else if(s[y-1][x] != '.' && s[y+1][x] != '.' && s[y][x-1] != '.'){
a++;
// YLHÄÄLLÄ, ALHAALLA, VASEMMALLA
/*
.....
..1..
.1A..
..1..
.....
*/
if(s[y-1][x+1] != '.'){
/*
.....
..11.
.1A..
..1..
.....
*/
if(s[y+2][x] != '.'){
/*
.....
..11.
.1A..
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y-2][x+1] != '.'){
/*
...1.
..11.
.1A..
..1..
.....
*/
paallac = s[y-2][x+1];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y-1][x+1] != '.'){
}else if(s[y][x-2] != '.'){
/*
.....
..11.
11A..
..1..
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y-2][x] != '.'){
/*
..1..
..11.
.1A..
..1..
.....
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A..
..11.
.....
*/
if(s[y+1][x+2] != '.'){
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
.1A..
..11.
...1.
*/
paallac = s[y+1][x+1];
edessac = s[y+1][x];
takanac = s[y][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+2][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.....
..1..
.1A..
..11.
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A..
..11.
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
..1..
..1..
.1A..
..11.
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}
}
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A..
..1..
.....
*/
if(s[y-2][x+1] != '.'){
/*
..11.
..1..
.1A..
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-2][x+1];
b++;
}else if(s[y-1][x+1]!= '.'){
/*
..1..
..11.
.1A..
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y][x+1] != '.'){
/*
..1..
..1..
.1A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x+1] != '.'){
/*
..1..
..1..
.1A..
..11.
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y+2][x] != '.'){
}else if(s[y][x-2] != '.'){
}
}else if(s[y+2][x] != '.'){
/*
.....
..1..
.1A..
..1..
..1..
*/
if(s[y-2][x] != '.'){
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
.1A..
..1..
..11.
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+2][x+1];
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A..
..11.
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y+1][x+1];
b++;
}else if(s[y][x+1] != '.'){
/*
.....
..1..
.1A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
..11.
.1A..
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x];
b++;
}else if(s[y][x-2] != '.'){
}
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A..
..1..
.....
*/
if(s[y-2][x] != '.'){
}else if(s[y-1][x+1] != '.'){
/*
.....
..11.
11A..
..1..
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y-1][x+1];
b++;
}else if(s[y][x+1] != '.'){
/*
.....
..1..
11A1.
..1..
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
11A..
..11.
.....
*/
paallac = s[y][x-2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
}else if(s[y][x-3] != '.'){
}
}
}else if(s[y-1][x] != '.' && s[y+1][x] != '.' && s[y][x+1] != '.'){
/*
.....
..1..
..A1.
..1..
.....
*/
if(s[y-1][x-1] != '.'){
/*
.....
.11..
..A1.
..1..
.....
*/
if(s[y-1][x-2] != '.'){
}else if(s[y-2][x-1] != '.'){
/*
.1...
.11..
..A1.
..1..
.....
*/
paallac = s[y-2][x-1];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-2][x] != '.'){
/*
..1..
.11..
..A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
/*
.....
.11..
..A11
..1..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.11..
..A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
..A1.
.11..
.....
*/
if(s[y-1][x] != '.'){
/*
..1..
..1..
..A1.
.11..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
/*
.....
..1..
..A11
.11..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
/*
.....
..1..
..A1.
.11..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
..A1.
.11..
.1...
*/
paallac = s[y+2][x-1];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x+2] != '.'){
}
}else if(s[y][x+2] != '.'){
/*
.....
..1..
..A11
..1..
.....
*/
if(s[y-2][x] != '.'){
}else if(s[y-1][x-1] != '.'){
/*
.....
.11..
..A11
..1..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
..A11
.11..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+3] != '.'){
/*
......
..1...
..A111
..1...
......
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x+3];
oikeallac = s[y][x+1];
b++;
}else if(s[y+2][x] != '.'){
}else if(s[y][x-1] != '.'){
/*
.....
..1..
.1A11
..1..
.....
*/
paallac = s[y][x+2];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}
}else if(s[y+2][x] != '.'){
/*
.....
..1..
..A1.
..1..
..1..
*/
if(s[y+2][x-1] != '.'){
/*
.....
..1..
..A1.
..1..
.11..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+2][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
..A1.
.11..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x-1]!= '.'){
/*
.....
..1..
.1A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-1][x-1] != '.'){
/*
.....
.11..
..A1.
..1..
..1..
*/
paallac = s[y+2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2]!= '.'){
}
}else if(s[y-2][x] != '.'){
/*
..1..
..1..
..A1.
..1..
.....
*/
if(s[y-2][x-1] != '.'){
/*
.11..
..1..
..A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-2][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y-1][x-1] != '.'){
/*
..1..
.11..
..A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y-1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x-1] != '.'){
/*
..1..
..1..
.1A1.
..1..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
..1..
..1..
..A1.
.11..
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y+1][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
}
}
}
else if(s[y-1][x] != '.' && s[y][x-1] != '.' && s[y][x+1] != '.'){
a++;
// YLHÄÄLLÄ; VASEMMALLA; OIKEALLA
/*
.....
..1..
.1A1.
.....
.....
*/
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A1.
.....
.....
*/
if(s[y-3][x] != '.'){
/*
..1..
..1..
..1..
.1A1.
.....
.....
*/
paallac = s[y-2][x];
edessac = s[y-3][x];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y][x+2] != '.'){
}else if(s[y][x-2] != '.'){
}else if(s[y+1][x+1] != '.'){
/*
..1..
..1..
.1A1.
...1.
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x+1];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}else if(s[y+1][x-1] != '.'){
/*
..1..
..1..
.1A1.
.1...
.....
*/
paallac = s[y-2][x];
edessac = s[y+1][x-1];
takanac = s[y-1][x];
alhaallac = s[y][x];
vasemmallac = s[y][x-1];
oikeallac = s[y][x+1];
b++;
}
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A1.
.....
.....
*/
if(s[y-2][x] != '.'){
}else if(s[y+1][x-2] != '.'){
/*
.....
..1..
11A1.
1....
.....
*/
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
11A1.
.1...
.....
*/
b++;
}else if(s[y+1][x] != '.'){
/*
.....
..1..
11A1.
..1..
.....
*/
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
11A1.
...1.
.....
*/
b++;
}
}else if(s[y][x+2] != '.'){
/*
.....
..1..
.1A11
.....
.....
*/
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A11
.....
.....
*/
b++;
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
.1A11
.1...
.....
*/
b++;
}else if(s[y+1][x] != '.'){
/*
.....
..1..
.1A11
..1..
.....
*/
b++;
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A11
...1.
.....
*/
b++;
}else if(s[y+1][x+2] != '.'){
/*
.....
..1..
.1A11
.....
.....
*/
b++;
}
}else if(s[y+1][x+1] != '.'){
/*
.....
..1..
.1A1.
...1.
.....
*/
b++;
if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A1.
...1.
.....
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
..1..
11A1.
...1.
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
..1..
.1A11
...1.
.....
*/
b++;
}else if(s[y+1][x+2] != '.'){
/*
.....
..1..
.1A1.
...11
.....
*/
b++;
}else if(s[y+2][x+1] != '.'){
/*
.....
..1..
.1A1.
...1.
...1.
*/
b++;
}
}else if(s[y+1][x-1] != '.'){
/*
.....
..1..
.1A1.
.1...
.....
*/
if(s[y][x-2] != '.'){
/*
.....
..1..
11A1.
.1...
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
..1..
.1A11
.1...
.....
*/
b++;
}else if(s[y+1][x-2] != '.'){
/*
.....
..1..
.1A1.
11...
.....
*/
b++;
}else if(s[y+2][x-1] != '.'){
/*
.....
..1..
.1A1.
.1...
.1...
*/
b++;
}else if(s[y-2][x] != '.'){
/*
..1..
..1..
.1A1.
.1...
.....
*/
b++;
}
}
}
else if(s[y+1][x] != '.' && s[y][x-1] != '.' && s[y][x+1] != '.'){
a++;
// ALHAALLA VASEMMALLA OIKEALLA
/*
.....
.....
.1A1.
..1..
.....
*/
if(s[y+2][x] != '.'){
/*
.....
.....
.1A1.
..1..
..1..
*/
if(s[y-1][x] != '.'){
/*
.....
..1..
.1A1.
..1..
..1..
*/
b++;
}else if(s[y-1][x-1] != '.'){
/*
.....
.1...
.1A1.
..1..
..1..
*/
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
.1A1.
..1..
..1..
*/
b++;
}else if(s[y+3][x] != '.'){
/*
.....
.....
.1A1.
..1..
..1..
..1..
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
.....
11A1.
..1..
..1..
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
.....
.1A11
..1..
..1..
*/
b++;
}
}else if(s[y][x-2] != '.'){
/*
.....
.....
11A1.
..1..
.....
*/
if(s[y-1][x-2] != '.'){
/*
.....
1....
11A1.
..1..
.....
*/
b++;
}else if(s[y-1][x-1] != '.'){
/*
.....
.1...
11A1.
..1..
.....
*/
b++;
}else if(s[y-1][x] != '.'){
/*
.....
..1..
11A1.
..1..
.....
*/
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
11A1.
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.....
11A1.
..1..
..1..
*/
b++;
}
}else if(s[y][x+2] != '.'){
/*
.....
.....
.1A11
..1..
.....
*/
if(s[y-1][x-1] != '.'){
/*
.....
.1...
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x] != '.'){
/*
.....
..1..
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x+2] != '.'){
/*
.....
....1
.1A11
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.....
.1A11
..1..
..1..
*/
b++;
}
}else if(s[y-1][x-1] != '.'){
/*
.....
.1...
.1A1.
..1..
.....
*/
if(s[y-2][x-1] != '.'){
/*
.1...
.1...
.1A1.
..1..
.....
*/
b++;
}else if(s[y-1][x-2] != '.'){
/*
.....
11...
.1A1.
..1..
.....
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
.1...
11A1.
..1..
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
.1...
.1A11
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
.1...
.1A1.
..1..
..1..
*/
b++;
}
}else if(s[y-1][x+1] != '.'){
/*
.....
...1.
.1A1.
..1..
.....
*/
if(s[y-2][x+1] != '.'){
/*
...1.
...1.
.1A1.
..1..
.....
*/
b++;
}else if(s[y][x-2] != '.'){
/*
.....
...1.
11A1.
..1..
.....
*/
b++;
}else if(s[y][x+2] != '.'){
/*
.....
...1.
.1A11
..1..
.....
*/
b++;
}else if(s[y-1][x+2] != '.'){
/*
.....
...11
.1A1.
..1..
.....
*/
b++;
}else if(s[y+2][x] != '.'){
/*
.....
...1.
.1A1.
..1..
..1..
*/
b++;
}
}
}
if(b == 1){
countteri++;
}
}
if(countteri){
return 1;
}else{
cout << "vaarin\n";
}
}