#include <bits/stdc++.h>
using namespace std;
int t;
string a, b, c;
void solve() {
  cin >> a >> b >> c;
  for (int i = 0; i < a.size(); i++) {
    if (!(a[i] == c[i] || b[i] == c[i])) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
  return;
}
int main() {
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
