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