#include <bits/stdc++.h>
using namespace std;
int a, b, c, d[100001], e, f, ans, t;
string s, p, m;
int main() {
  cin >> t;
  while (t--) {
    b = 0;
    cin >> s >> p >> m;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == p[i] && s[i] != m[i])
        b = 1;
      else {
        if (m[i] == s[i] || m[i] == p[i])
          continue;
        else
          b = 1;
      }
    }
    if (b == 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
