#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
  T x;
  cin >> x;
  return x;
}
template <typename T>
void print(vector<T> v) {
  for (auto i : v) {
    cout << i << " ";
  }
  cout << "\n";
}
template <typename T>
void printArr(T *arr, int s, int n) {
  for (int i = s; i <= n; i++) {
    cout << arr[i] << " ";
  }
  cout << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    bool ok = true;
    for (long long int(i) = 0; (i) < (a.size()); (i)++) {
      if (a[i] == c[i] || b[i] == c[i]) {
      } else {
        ok = false;
      }
    }
    if (ok)
      cout << ("YES") << "\n";
    else
      cout << ("NO") << "\n";
  }
  return 0;
}
