#include <bits/stdc++.h>
using namespace std;
char s1[100010];
char s2[100010];
char s3[100010];
int main() {
  int i, j, k;
  int n, t, m;
  cin >> t;
  while (t--) {
    scanf("%s%s%s", s1, s2, s3);
    int len = strlen(s1);
    int cnt = 0;
    int err = 0;
    int good = 0;
    for (i = 0; i < len; i++) {
      if (s1[i] == s3[i] || s2[i] == s3[i]) {
        ;
      } else
        break;
    }
    if (i < len) {
      puts("NO");
    } else
      puts("YES");
  }
  return 0;
}
