#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    int flag = 0;
    string a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < a.length(); i++) {
      if (c[i] != a[i] && c[i] != b[i]) {
        flag = 1;
        break;
      }
    }
    if (flag)
      cout << "NO";
    else
      cout << "YES";
    cout << endl;
  }
  return 0;
}
