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