#include <bits/stdc++.h>
using namespace std;
void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  bool ok = 1;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] != c[i] and b[i] != c[i]) ok = 0;
    if (not ok) break;
  }
  if (ok)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    solve();
  }
  return 0;
}
