#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65536000")
using namespace std;
const double eps = 1e-8;
void solve() {
  string s, t, p;
  cin >> s >> t >> p;
  int t_pos = 0;
  vector<int> a(26);
  for (int i = 0; i < (int)(s.size()); ++i) {
    while (t_pos < t.size() && s[i] != t[t_pos]) a[t[t_pos] - 'a']++, t_pos++;
    if (t_pos >= t.size()) {
      t_pos = -1;
      break;
    }
    t_pos++;
  }
  if (t_pos == -1) {
    cout << "NO";
    return;
  }
  while (t_pos < t.size()) a[t[t_pos++] - 'a']++;
  for (auto ch : p) a[ch - 'a']--;
  for (int i = 0; i < (int)(26); ++i)
    if (a[i] > 0) {
      cout << "NO";
      return;
    }
  cout << "YES";
}
void solve_multiple() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    solve();
    cout << endl;
  }
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  solve_multiple();
  return 0;
}
