#include <bits/stdc++.h>
using namespace std;
void solve(long long int caseno) {
  long long int i, j, n;
  bool ans = true;
  string a, b, c;
  cin >> a >> b >> c;
  n = a.size();
  for (i = 0; i < n; i++) {
    if (!((b[i] == c[i]) || (a[i] == c[i]))) {
      ans = false;
    }
  }
  cout << (ans ? "YES" : "NO") << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  for (long long int i = 1; i <= t; i++) {
    solve(i);
  }
  return 0;
}
