#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s, s1, s2;
    cin >> s >> s1 >> s2;
    bool lock = false;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == s2[i]) {
        swap(s1[i], s2[i]);
      } else {
        if (s1[i] == s2[i]) {
          swap(s[i], s2[i]);
        } else {
          lock = true;
          break;
        }
      }
    }
    if (lock)
      cout << "NO" << endl;
    else {
      if (s == s1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
