#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string a, b, c;
    cin >> a >> b >> c;
    int f = 1;
    for (int i = 0; i < a.length(); i++) {
      if (c[i] != b[i] && a[i] != c[i]) {
        f = 0;
        break;
      }
    }
    f == 1 ? cout << "YES" : cout << "NO";
    cout << endl;
  }
  return 0;
}
