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