#include <bits/stdc++.h>
using namespace std;
string a, b, c;
int t, sz;
int main() {
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> a >> b >> c;
    sz = a.size();
    bool flag = true;
    for (int j = 0; j < sz; j++) {
      if (a[j] != b[j] && a[j] != c[j] && b[j] != c[j]) {
        cout << "NO\n";
        flag = false;
        break;
      }
      if (a[j] == b[j] && c[j] != a[j]) {
        cout << "NO\n";
        flag = false;
        break;
      }
    }
    if (flag) cout << "YES\n";
  }
  return 0;
}
