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