#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s, t, p;
    cin >> s >> t >> p;
    int par[26] = {0};
    int d = 0;
    for (int i = 0; i < p.size(); i++) {
      par[p[i] - 'a']++;
    }
    for (int i = 0; i < t.size(); i++) {
      if (s[i] != t[i] && par[t[i] - 'a']) {
        par[t[i] - 'a']--;
        s.insert(s.begin() + i, t[i]);
      } else if (s[i] != t[i] && par[t[i] - 'a'] == 0) {
        d = 1;
        break;
      }
    }
    if (s != t || d == 1) {
      cout << "NO" << endl;
    } else
      cout << "YES" << endl;
  }
  return 0;
}
