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