#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  string a, b, c;
  cin >> t;
  while (t--) {
    cin >> a;
    cin >> b;
    cin >> c;
    for (int i = 0; i < a.length(); 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\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
