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