#include <bits/stdc++.h>
using namespace std;
const int mx = 1234567;
const double eps = 1e-6;
const int md = 1e9 + 7;
const double pi = acos(-1.0);
int ar[mx], xar[mx], uses[mx];
long long arr[mx];
int tab[1000][1000];
string st[1000];
map<int, int> mpii;
map<int, char> mpic;
map<char, int> mpci;
pair<int, int> pr[mx];
bool cmp(const int a, const int b) { return a > b; }
int ar1[mx], ar2[mx], ar3[mx], ar4[mx];
map<char, int> ch;
int main() {
  int tk = 1, n, m;
  long long x, y, z;
  scanf("%d", &tk);
  while (tk--) {
    string s;
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    int f = 1;
    for (int i = 0; i < s1.size(); i++) {
      if (s1[i] == s3[i] || s2[i] == s3[i]) continue;
      if (s1[i] == s2[i]) {
        f = 0;
        break;
      } else {
        f = 0;
        break;
      }
    }
    if (f == 1) {
      cout << "YES" << endl;
      continue;
    }
    cout << "NO" << endl;
  }
  return 0;
}
