#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    int f = 1, x = 0;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] == c[i] || b[i] == c[i])
        x++;
      else {
        f = 0;
        break;
      }
    }
    if (f == 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
