#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, i, j, k, p, q, o, l, s, t, z;
  string a, b, c;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c;
    k = 1;
    for (i = 0; b[i]; i++) {
      if (b[i] != c[i] && a[i] != c[i]) {
        k = 0;
        break;
      }
    }
    if (k == 0) {
      cout << "NO"
           << "\n";
    } else {
      cout << "YES"
           << "\n";
    }
  }
  return 0;
}
