#include <bits/stdc++.h>
using namespace std;
inline long long fast_power(long long base, long long power) {
  long long result = 1;
  base = base % 1000000007;
  while (power > 0) {
    if (power % 2 == 1) {
      result = (result * base) % 1000000007;
    }
    base = (base * base) % 1000000007;
    power = power >> 1;
  }
  return result;
}
inline long long modInverse(long long a) {
  return fast_power(a, 1000000007 - 2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    int flag = 0;
    string a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < a.length(); i++) {
      if (a[i] == c[i] || b[i] == c[i])
        continue;
      else {
        flag = 1;
        break;
      }
    }
    if (flag)
      cout << "NO" << '\n';
    else
      cout << "YES" << '\n';
    ;
  }
  return 0;
}
