#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
const long long N = 2e5 + 5, K = 105;
const int si = (1 << 20);
const long long add = 1e4;
const long long M = 100 + 5;
const double INFdb = 1e10;
void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  for (int i = 0; i < a.size(); ++i) {
    if (a[i] != c[i] && b[i] != c[i]) {
      cout << "NO"
           << "\n";
      return;
    }
  }
  cout << "YES"
       << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
