#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    int a = 0, b = 0;
    for (int i = 0; i < s1.size(); i++) {
      if (s1[i] == s3[i] || s2[i] == s3[i]) b++;
    }
    if (b >= s1.size()) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
  return 0;
}
