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