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