#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
void put1() { puts("YES"); }
void put2() { puts("NO"); }
void put3() { puts("-1"); }
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
using namespace std;
const int manx = 1e5 + 5;
int main() {
  long long p = read();
  while (p--) {
    string a, b, c;
    cin >> a >> b >> c;
    int ok = 1;
    for (int i = 0; i < a.length(); i++) {
      if (a[i] == b[i] && b[i] == c[i])
        continue;
      else if (a[i] == c[i])
        continue;
      else if (b[i] == c[i])
        continue;
      else {
        ok = 0;
        break;
      }
    }
    if (ok)
      put1();
    else
      put2();
  }
  return 0;
}
