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