#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int flag = 0;
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    for (int i = 0; i < s1.length(); i++) {
      if (s1[i] == s2[i] == s3[i]) {
        continue;
      } else if (s3[i] == s1[i]) {
        s2[i] = s3[i];
      } else if (s3[i] == s2[i]) {
        s1[i] = s3[i];
      } else if (s2[i] == s1[i] != s3[i]) {
        cout << "NO" << endl;
        flag = 1;
        break;
      } else {
        cout << "NO" << endl;
        break;
      }
    }
    if (s1 == s2 && flag == 0) {
      cout << "YES" << endl;
    }
  }
}
