#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  string a, b, c;
  cin >> n;
  while (n--) {
    cin >> a >> b >> c;
    bool ok = 1;
    for (int i = 0; i < c.size(); i++)
      if (c[i] != a[i] && c[i] != b[i]) ok = 0;
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
