#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T;
  cin >> T;
  while (T--) {
    string a, b, c;
    cin >> a >> b >> c;
    long long n = a.length(), flag = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == c[i]) {
        swap(b[i], c[i]);
      } else if (b[i] == c[i]) {
        swap(a[i], c[i]);
      } else {
        flag = 1;
        break;
      }
    }
    if (flag) {
      cout << "NO" << endl;
    } else
      cout << "YES" << endl;
  }
}
