#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s1, s2, s3;
  cin >> n;
  while (n--) {
    cin >> s1 >> s2 >> s3;
    for (int i = 0; i < s1.length(); i++) {
      if (s3.at(i) != s2.at(i) && s3.at(i) != s1.at(i)) {
        cout << "NO\n";
        break;
      }
      if (i == s1.length() - 1) cout << "YES\n";
    }
  }
  return 0;
}
