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