#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &r) {
  static char c;
  r = 0;
  int f = 1;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9';
       r = (r << 1) + (r << 3) + (c ^ 48), c = getchar())
    ;
  r *= f;
}
const int MOD = 1e9 + 7;
const int N = 1e5 + 15;
void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  int f = 1;
  for (int i = 0; i < (int)a.size(); ++i) {
    if (b[i] != c[i] && a[i] != c[i]) f = 0;
  }
  if (f)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
int main() {
  int t = 1;
  read(t);
  while (t--) solve();
}
