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