#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
char a[maxn], b[maxn], c[maxn];
bool check(int n) {
  for (int i = 0; i < n; i++)
    if (c[i] != a[i] && c[i] != b[i]) return 0;
  return 1;
}
int main() {
  int T;
  for (scanf("%d", &T); T; T--) {
    scanf("%s", a);
    scanf("%s", b);
    scanf("%s", c);
    if (check(strlen(a)))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
