#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    bool pos = true;
    for (long long i = 0; i < b.size(); i++) {
      if (c[i] != a[i] && c[i] != b[i]) {
        pos = false;
        break;
      }
    }
    if (pos)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
