#include <bits/stdc++.h>
using namespace std;
bool codejam = 0;
void solve();
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(20);
  long long t = 1;
  cin >> t;
  long long tt = t;
  while (t--) {
    if (codejam) cout << "Case #" << tt - t << ": ";
    solve();
  }
  return 0;
}
void solve() {
  string s[3];
  for (long long i = 0; i < 3; ++i) cin >> s[i];
  long long j = 0;
  for (long long i = 0; i < (long long)s[1].size(); ++i) {
    if (j == (long long)s[0].size()) break;
    if (s[1][i] == s[0][j]) ++j;
  }
  if (j != (long long)s[0].size()) {
    cout << "NO\n";
    return;
  }
  long long cnt[3][26];
  memset(cnt, 0, sizeof cnt);
  for (long long i = 0; i < 3; ++i) {
    for (auto j : s[i]) {
      cnt[i][j - 'a'] += 1;
    }
  }
  for (long long i = 0; i < 26; ++i) {
    if (cnt[0][i] + cnt[2][i] < cnt[1][i]) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
