#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 123;
int n, m, a, b;
int temp;
long long sum[N];
int main() {
  int t;
  cin >> t;
  string s_1, s_2, s_3;
  for (int i = 0; i < t; i++) {
    cin >> s_1 >> s_2 >> s_3;
    n = s_1.size();
    for (int j = 0; j < n; j++)
      if (s_1[j] != s_2[j] && s_1[j] == s_3[j])
        temp++;
      else if (s_1[j] != s_2[j] && s_2[j] == s_3[j])
        temp++;
      else if (s_1[j] == s_2[j] && s_1[j] == s_3[j])
        temp++;
    if (temp == n)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    temp = 0;
  }
}
