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