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