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