#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, p, k, t, temp;
  string a, b, c;
  cin >> t;
  for (long long jjj = 0; jjj < t; jjj++) {
    bool x = 0;
    cin >> a >> b >> c;
    for (long long i = 0; i < c.size(); i++) {
      if (a[i] == b[i]) {
        if (a[i] != c[i]) {
          x = 1;
          break;
        }
      } else {
        if (a[i] != c[i] && b[i] != c[i]) {
          x = 1;
          break;
        }
      }
    }
    if (x)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
