#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<long long>;
void solve() {
  string s, t, p;
  cin >> s >> t >> p;
  int is = 0;
  int it = 0;
  map<char, int> needs;
  for (is = 0; is < s.length(); is++) {
    while (it < t.length() && s[is] != t[it]) {
      if (needs.count(t[it]) == 0) needs[t[it]] = 0;
      needs[t[it]]++;
      it++;
    }
    if (it == t.length()) {
      cout << "NO" << endl;
      return;
    }
    it++;
  }
  while (it < t.length()) {
    if (needs.count(t[it]) == 0) needs[t[it]] = 0;
    needs[t[it]]++;
    it++;
  }
  for (char cp : p) {
    needs[cp]--;
  }
  for (auto pair : needs) {
    if (pair.second > 0) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
