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