#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int res[t];
  for (int i = 0; i < t; i++) {
    string a;
    string b;
    string c;
    cin >> a;
    cin >> b;
    cin >> c;
    int l = a.length();
    int co = 0;
    for (int j = 0; j < l; j++) {
      if (a[j] == c[j] || b[j] == c[j]) {
        continue;
      } else {
        res[i] = 0;
        co++;
        break;
      }
    }
    if (co == 0) {
      res[i] = 1;
    }
  }
  for (int i = 0; i < t; i++) {
    if (res[i] == 0) {
      cout << "NO";
      cout << "\n";
    } else {
      cout << "YES";
      cout << "\n";
    }
  }
  return 0;
}
