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