#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long i, j, q, n;
  cin >> q;
  while (q--) {
    string a, b, c;
    cin >> a >> b >> c;
    n = a.length();
    long long flag = 0;
    for (i = 0; i < n; i++) {
      if (a[i] != b[i]) {
        if ((b[i] != c[i] && a[i] != c[i])) {
          cout << "NO" << endl;
          flag = 1;
          break;
        }
      } else if (a[i] == b[i] && b[i] != c[i] && a[i] != c[i]) {
        cout << "NO" << endl;
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << "YES" << endl;
    }
  }
  return 0;
}
