#include <bits/stdc++.h>
using namespace std;
void reader() {}
void IOFast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void solve() {
  string p, s, t;
  bool ans = false;
  cin >> s >> t >> p;
  map<char, long long> mapp;
  long long m = s.length();
  long long n = t.length();
  long long dp[m + 1][n + 1];
  for (long long i = 0; i <= m; i++) dp[i][0] = 0;
  for (long long j = 0; j <= n; j++) dp[0][j] = 0;
  long long i, j;
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      if (s[i - 1] == t[j - 1])
        dp[i][j] = 1 + dp[i - 1][j - 1];
      else
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    }
  }
  if (dp[m][n] == m) ans = true;
  long long o = p.length();
  for (long long i = 0; i < n; i++) mapp[t[i]]++;
  for (long long i = 0; i < o; i++) mapp[p[i]]--;
  for (long long i = 0; i < m; i++) mapp[s[i]]--;
  for (auto i : mapp)
    if (i.second > 0) ans = false;
  if (ans)
    cout << "YES";
  else
    cout << "NO";
  cout << "\n";
}
signed main() {
  reader();
  IOFast();
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
