#include <bits/stdc++.h>
using namespace std;
void yes() { cout << "YES" << endl; }
void no() { cout << "NO" << endl; }
void solve(int qq) {
  string a, b, c;
  cin >> a >> b >> c;
  int n = a.size();
  bool bo = true;
  for (int i = 0; i < n; i++) {
    if (a[i] == c[i] || b[i] == c[i]) {
      continue;
    } else {
      bo = false;
    }
  }
  if (bo) {
    yes();
  } else {
    no();
  }
}
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve(i);
  }
  return 0;
}
