#include <bits/stdc++.h>
using namespace std;
void c_p_n() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  c_p_n();
  long long x;
  cin >> x;
  while (x--) {
    long long j = 0;
    string a, b, c;
    cin >> a >> b >> c;
    long long l = a.length();
    for (long long i = 0; i <= l - 1; i++) {
      if (b[i] == c[i] || a[i] == c[i]) {
        j++;
      }
    }
    if (j == l)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
