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