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