#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  int n = a.size();
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == c[i] || c[i] == b[i]) {
      count++;
    }
  }
  if (count == n) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
