#include <bits/stdc++.h>
using namespace std;
long long exp(long long n, long long m, long long md) {
  long long a = 1;
  while (m > 0) {
    if (m & 1) a = (a * n % md) % md;
    m /= 2;
    n = (n * n) % md;
  }
  return a % md;
}
int 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 flag = true;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] != c[i] && c[i] != b[i]) flag = false;
    }
    if (flag)
      cout << "YES";
    else
      cout << "NO";
    cout << "\n";
  }
}
