#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, n, i, j, k, l, sign = 1;
  char s1[105];
  char s2[105];
  char s3[105];
  cin >> tc;
  while (tc--) {
    scanf("%s", &s1);
    scanf("%s", &s2);
    scanf("%s", &s3);
    l = strlen(s1);
    for (i = 0; i < l; i++) {
      if (s1[i] != s3[i] && s2[i] != s3[i]) {
        sign = -1;
        break;
      }
    }
    if (sign == 1) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    sign = 1;
  }
  return 0;
}
