#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 count = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == c[i] || b[i] == c[i]) {
        count++;
      }
    }
    if (count == n) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
