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