#include <bits/stdc++.h>
using namespace std;
char s[110], a[110], b[110], c[110];
int main() {
  long long t, i, j, k, m, n;
  scanf("%lld", &t);
  while (t--) {
    scanf(" %s %s %s", a, b, c);
    long long l = strlen(a);
    bool in = 0;
    for (i = 0; i < l; i++) {
      if (a[i] == c[i] || b[i] == c[i]) continue;
      in = 1;
      break;
    }
    if (in)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
