#include <bits/stdc++.h>
using namespace std;
void print(long long a[], long long n) {
  for (long long i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
int main() {
  int test;
  cin >> test;
  cin.ignore();
  while (test--) {
    string a, b, c;
    cin >> a >> b >> c;
    int flag = 0;
    for (int i = 0; i < a.length(); i++) {
      if ((a[i] == c[i]) || (b[i] == c[i])) {
        continue;
      } else {
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
