#include <bits/stdc++.h>
using namespace std;
long long int euclid_algo(long long int a, long long int b) {
  while (a != 0 && b != 0) {
    if (a > b)
      a = a % b;
    else
      b = b % a;
  }
  return a + b;
}
long long int NOK(long long int a, long long int b) {
  return a * b / euclid_algo(a, b);
}
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; ++i) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    bool ans = true;
    for (int i = 0; i < s3.size(); ++i) {
      if (s1[i] == s2[i] && s3[i] != s1[i]) {
        ans = false;
        break;
      } else if (s1[i] != s2[i] && (s3[i] != s2[i] && s3[i] != s1[i])) {
        ans = false;
        break;
      }
    }
    if (ans)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
