#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.size();
    bool Ok = true;
    for (int i = 0; i < n; i++) Ok &= (c[i] == a[i] || b[i] == c[i]);
    puts(Ok ? "YES" : "NO");
  }
}
