#include <bits/stdc++.h>
using namespace std;
string a, b, c;
using namespace std;
void solve() {
  cin >> a >> b >> c;
  for (int i = 0; i < (int)a.size(); i++) {
    if (a[i] != c[i] && b[i] != c[i]) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
