#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
const int N = 1e5 + 7;
const int M = 1e6 + 7;
const int INF = 1e9 + 8;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    int flag = 0;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == b[i]) {
        if (c[i] != b[i]) flag = 1;
      }
      if (a[i] != b[i]) {
        if (a[i] != c[i] && b[i] != c[i]) flag = 1;
      }
    }
    if (flag)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
