#include <bits/stdc++.h>
char str1[105], str2[105], str3[105];
int main() {
  int T;
  std::cin >> T;
  while (T--) {
    scanf("%s%s%s", str1, str2, str3);
    int n = strlen(str1);
    bool ok = 0;
    for (int i = 0; i < n; i++) {
      ok = 0;
      if (str1[i] == str3[i]) ok = 1;
      if (str2[i] == str3[i]) ok = 1;
      if (!ok) {
        puts("NO");
        break;
      }
    }
    if (ok) puts("YES");
  }
}
