#include <bits/stdc++.h>
using namespace std;
using namespace std;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
void ia(T a[], int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void pa(T a[], int n) {
  for (int i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
template <typename T>
long long int isLeft(T a, T b, T c) {
  return (c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y);
}
template <typename T>
inline T POW(T B, T printf) {
  if (printf == 0) return 1;
  if (printf & 1)
    return B * POW(B, printf - 1);
  else
    return (POW(B, printf / 2) * POW(B, printf / 2));
}
template <typename T>
inline T Bigmod(T b, T p, T m) {
  if (p == 0)
    return 1;
  else if (!(p & 1))
    return (Bigmod(b, p / 2, m) * Bigmod(b, p / 2, m)) % m;
  else
    return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
template <typename T>
inline T Dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
inline T Angle(T x1, T y1, T x2, T y2) {
  return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T>
inline T DIFF(T a, T b) {
  T d = a - b;
  if (d < 0)
    return -d;
  else
    return d;
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <typename T>
inline T euclide(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int cdigittoint(char ch) { return ch - '0'; }
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
struct z {
  int m, n;
};
char s[100][109];
int vis[109][109];
int dxx[4] = {2, 2, -2, -2};
int dyy[4] = {-2, 2, -2, 2};
int BFS(int a, int b, int c, int d) {
  queue<z> q;
  z tp;
  tp.m = a;
  tp.n = b;
  q.push(tp);
  vis[a][b] = 1;
  while (q.size()) {
    z u = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      z v;
      v.m = u.m + dxx[i];
      v.n = u.n + dyy[i];
      if (vis[v.m][v.n] == 0) {
        vis[v.m][v.n] = 1;
        q.push(v);
        if (v.m == c && v.n == d) return 1;
      }
    }
  }
  return 0;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    getchar();
    memset(vis, -1, sizeof vis);
    int tst = 0, sx, sy, dx, dy;
    for (int j = 2; j <= 9; j++) {
      for (int k = 2; k <= 9; k++) {
        cin >> s[j][k];
        vis[j][k] = 0;
        if (s[j][k] == 'K' && tst) {
          sx = j;
          sy = k;
        } else if (s[j][k] == 'K') {
          tst = 1;
          dx = j;
          dy = k;
        }
      }
      getchar();
    }
    if (abs(sx - dx) % 4 == 0 && abs(dy - sy) % 4 == 0) {
      cout << "YES\n";
    } else
      cout << "NO\n";
  }
  return (0);
}
