#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  getchar();
  for (int i = 0; i < t; i++) {
    char a[200], b[200], c[200];
    scanf("%s%s%s", a, b, c);
    int len = strlen(a);
    bool f = 1;
    for (int j = 0; j < len; j++) {
      if (!(a[j] == c[j] || b[j] == c[j])) {
        printf("NO\n");
        f = 0;
        break;
      }
    }
    if (f) printf("YES\n");
  }
  return 0;
}
