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