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