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