#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-6;
const long double pi = acos(-1);
int main() {
  ios_base::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;
    long long cnt = 0, n = a.size();
    for (long long i = 0; i < n; i++) {
      if (a[i] == b[i] && a[i] == c[i])
        cnt++;
      else if (b[i] == c[i])
        cnt++;
      else if (a[i] == c[i])
        cnt++;
    }
    if (cnt == n)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
