#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  for (long long u = 0; u < t; u++) {
    long long n, p = 0;
    string a, b, c;
    cin >> a >> b >> c;
    for (long long i = 0; i < a.length(); i++) {
      if (a[i] == b[i] && a[i] != c[i]) {
        cout << "NO"
             << "\n";
        p++;
        break;
      }
      if (c[i] != a[i] && c[i] != b[i]) {
        cout << "NO"
             << "\n";
        p++;
        break;
      }
    }
    if (p != 0) continue;
    cout << "YES"
         << "\n";
  }
}
