#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    int l = a.length();
    bool can = true;
    for (int i = 0; i < l && can; i++) {
      if (a[i] == b[i]) {
        can = a[i] == c[i];
      } else {
        can = a[i] == c[i] || b[i] == c[i];
      }
    }
    if (can) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
