#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int cnt = 0, i;
    string str1, str2, str3;
    cin >> str1 >> str2 >> str3;
    for (i = 0; i < str1.size(); i++) {
      if (str1[i] == str3[i] || str3[i] == str2[i]) {
        cnt++;
      }
    }
    if (cnt == str1.size()) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
