#include <bits/stdc++.h>
using namespace std;
void solve(long long tc) {
  vector<long long> cnt(26, 0);
  string s, t, p;
  cin >> s >> t >> p;
  for (auto ch : p) cnt[ch - 'a']++;
  long long i = 0;
  long long j = 0;
  long long n = s.size();
  long long m = t.size();
  while (i < n and j < m) {
    if (s[i] == t[j]) {
      i++;
      j++;
    } else {
      if (cnt[t[j] - 'a'] > 0) {
        cnt[t[j] - 'a']--;
        j++;
      } else {
        break;
      }
    }
  }
  while (j < m) {
    if (cnt[t[j] - 'a'] > 0) {
      cnt[t[j] - 'a']--;
      j++;
    } else {
      break;
    }
  }
  if (i == n and j == m) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  long long t, x;
  t = 1;
  cin >> t;
  long long tc = 1;
  while (t--) {
    solve(tc);
    tc++;
  }
}
