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