#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 224;
const long long INF = 1e9;
void solve() {
  string s, t, p, need = "";
  cin >> s >> t >> p;
  bool ok = true;
  long long it1 = 0, it2 = 0;
  while (it1 < s.size() && it2 < t.size()) {
    if (s[it1] == t[it2]) {
      it1++, it2++;
    } else {
      need += t[it2];
      it2++;
    }
  }
  while (it2 != t.size()) need += t[it2++];
  if (it1 != s.size()) ok = false;
  map<char, int> mp;
  for (auto &i : p) mp[i]++;
  for (auto &i : need) {
    if (mp[i] > 0) {
      mp[i]--;
    } else {
      ok = false;
    }
  }
  if (ok)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
