#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int o = 0; o < t; o++) {
    string a;
    string b;
    string c;
    cin >> a;
    cin >> b;
    cin >> c;
    int g = 0;
    int n = a.length();
    for (int i = 0; i < n; i++) {
      if (c[i] == a[i] || c[i] == b[i]) g++;
    }
    if (g == n)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
