#include <bits/stdc++.h>
using namespace std;
int A[9][9];
int pt(int A[9][9]) {
  int i, j;
  for (i = 1; i <= 8; i++) {
    for (j = 1; j <= 8; j++) cout << A[i][j];
    cout << "\n";
  }
}
void fn(int a, int b) {
  if (a >= 1 && a <= 8 && b >= 1 && b <= 8) {
    if (A[a][b] == 0) {
      A[a][b] = 1;
      fn(a + 2, b + 2);
      fn(a + 2, b - 2);
      fn(a - 2, b + 2);
      fn(a - 2, b - 2);
    }
    if (A[a][b] == -1) {
      A[a][b] = -2;
      fn(a + 2, b + 2);
      fn(a + 2, b - 2);
      fn(a - 2, b + 2);
      fn(a - 2, b - 2);
    }
  }
}
int main() {
  char c;
  int i, j, test, test1;
  cin >> test;
  test1 = test;
  int ans[51];
  int ai = 0;
  while (test) {
    int S[2][2], s1 = 0, s2 = 0;
    for (i = 1; i <= 8; i++)
      for (j = 1; j <= 8; j++) {
        cin >> c;
        if (c == '.')
          A[i][j] = 0;
        else if (c == '#')
          A[i][j] = -1;
        else {
          A[i][j] = 0;
          S[s1][0] = i;
          S[s1][1] = j;
          s1++;
        }
      }
    int t = S[0][0] > S[1][0] ? S[0][0] - S[1][0] : -S[0][0] + S[1][0];
    int t1 = S[0][1] > S[1][1] ? S[0][1] - S[1][1] : -S[0][1] + S[1][1];
    if (t % 4 == 0 && t1 % 4 == 0)
      cout << "YES\n";
    else
      cout << "NO\n";
    test--;
  }
  return 0;
}
