#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    long long n = a.length();
    long long f = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] == b[i]) {
        if (a[i] == c[i] || b[i] == c[i]) {
        } else {
          f = 1;
          break;
        }
      } else {
        if (a[i] == c[i] || b[i] == c[i]) {
        } else {
          f = 1;
          break;
        }
      }
    }
    if (f == 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
