#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 6;
int t;
int main() {
  scanf("%d", &t);
  while (t--) {
    string s, s1, s2;
    cin >> s;
    cin >> s1;
    cin >> s2;
    bool flag = true;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == s1[i] && s[i] != s2[i]) {
        flag = false;
      }
      if (s[i] != s2[i] && s1[i] != s2[i]) {
        flag = false;
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
