#include <bits/stdc++.h>
using namespace std;
int pr(int n, int dif = 0) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0 && i != dif) return i;
  return n;
}
char a[400400];
char b[400400];
char c[400400];
int main() {
  int nt;
  scanf("%d", &nt);
  while (nt--) {
    scanf(" %s %s %s", a, b, c);
    int n = strlen(a);
    int ok = 1;
    for (int i = 0; i < n; i++) {
      if (a[i] == c[i] || b[i] == c[i])
        ;
      else
        ok = 0;
    }
    if (ok)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
