#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 = c.length(), flag = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == c[i] && b[i] == c[i]) {
        flag = 0;
      } else if (a[i] == c[i] || b[i] == c[i]) {
        flag = 0;
      } else if (a[i] == b[i] && a[i] != c[i]) {
        flag = 1;
        break;
      } else {
        flag = 1;
        break;
      }
    }
    if (flag == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
