#include <bits/stdc++.h>
using namespace std;
ostream &operator<<(ostream &out, vector<long long> &a) {
  for (auto i : a) out << i << " ";
  return out;
}
istream &operator>>(istream &in, vector<long long> &a) {
  for (auto &i : a) in >> i;
  return in;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  while (n--) {
    string a, b, c;
    cin >> a >> b >> c;
    bool boo = 0;
    for (long long i = 0; i < a.size(); ++i) {
      if (c[i] != a[i] && c[i] != b[i]) {
        boo = 1;
        cout << "NO\n";
        break;
      }
    }
    if (!boo) cout << "YES\n";
  }
  return 0;
}
