#include <bits/stdc++.h>
using namespace std;
mt19937 mt_rand(time(0));
const int N = 105;
int t, n;
char a[N], b[N], c[N];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%s%s%s", a, b, c);
    n = 0;
    while (a[n]) n++;
    bool ok = 1;
    for (int i = 0; i < n; i++) {
      if (c[i] == a[i] || c[i] == b[i])
        ;
      else
        ok = 0;
    }
    if (!ok)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
