#include <bits/stdc++.h>
using namespace std;
int t, r;
string a, b, c;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  cin.ignore();
  while (t--) {
    cin >> a >> b >> c;
    r = 0;
    bool ok = 1;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == c[i] || b[i] == c[i]) r++;
      if (a[i] == b[i]) {
        if (c[i] != a[i]) {
          ok = 0;
          cout << "NO\n";
          break;
        }
      }
    }
    if (ok) {
      if (r == a.size())
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
