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