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