#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    int l = s1.length();
    int br = 0;
    for (int i = 0; i < l; i++) {
      if (s1[i] == s2[i]) {
        if (s1[i] != s3[i]) {
          br = 1;
          break;
        }
      } else {
        if (s3[i] == s1[i] || s3[i] == s2[i]) {
        } else {
          br = 1;
          break;
        }
      }
    }
    if (br == 1) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
}
