#include <bits/stdc++.h>
using namespace std;
void solve(void) {
  string a, b, c;
  cin >> a >> b >> c;
  int n = a.length();
  for (int i = 0; i < n; i++) {
    if (c[i] != a[i] && c[i] != b[i]) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
int main(void) {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
