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