#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s, t, p;
  cin >> s >> t >> p;
  map<long long, long long> m;
  bool ans = true;
  long long j = 0;
  for (long long i = 0; i < p.length(); i++) m[p[i] - 'a']++;
  for (long long i = 0; i < t.length(); i++) {
    if (t[i] != s[j]) {
      if (m[t[i] - 'a'] > 0)
        m[t[i] - 'a']--;
      else {
        cout << "NO\n";
        return;
      }
    } else
      j++;
  }
  j == s.length() ? cout << "YES\n" : cout << "NO\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test_cases = 1;
  cin >> test_cases;
  for (long long t = 1; t <= test_cases; t++) solve();
  return 0;
}
