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