#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
const int mod = 1e9 + 7;
char a[maxn], b[maxn], c[maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%s%s%s", a + 1, b + 1, c + 1);
    int n = strlen(a + 1), f = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == c[i] || b[i] == c[i]) continue;
      f = 1;
      break;
    }
    if (f)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
