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