#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, i, j;
  string s, t, p;
  cin >> s >> t >> p;
  int sl, tl, pl;
  sl = s.length();
  tl = t.length();
  pl = p.length();
  int tt[tl], pp[26];
  memset(tt, 0, sizeof(tt));
  memset(pp, 0, sizeof(pp));
  for (char c : p) pp[c - 'a']++;
  i = 0, j = 0;
  while (i < sl && j < tl) {
    if (s[i] == t[j]) {
      tt[j] = 1;
      i++;
    }
    j++;
  }
  if (i != sl) {
    cout << "NO" << endl;
    return;
  }
  for (i = 0; i < tl; i++) {
    if (tt[i] == 0) pp[t[i] - 'a']--;
    if (pp[t[i] - 'a'] < 0) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
