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