#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
template <class T>
inline void read(T &res) {
  char c;
  T flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') res = res * 10 + c - '0';
  res *= flag;
}
string a, b, c;
int t;
int main() {
  cin >> t;
  while (t--) {
    cin >> a >> b >> c;
    int flag = 0;
    for (int i = 0; i < a.length(); i++) {
      if (c[i] != a[i] && c[i] != b[i]) flag = 1;
    }
    if (flag)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
