#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int K = 26;
int main() {
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  while (q--) {
    string s, t, p;
    cin >> s >> t >> p;
    vector<int> cnt(K);
    for (char c : p) cnt[c - 'a']++;
    int i, j;
    for (i = 0, j = 0; i < (int)s.length();) {
      while (j < (int)t.length() && t[j] != s[i]) {
        cnt[t[j] - 'a']--;
        j++;
      }
      if (j == (int)t.length()) break;
      i++;
      j++;
    }
    while (j < (int)t.length()) cnt[t[j++] - 'a']--;
    bool check = i == (int)s.length();
    for (i = 0; i < K; i++) check &= cnt[i] >= 0;
    cout << (check ? "YES" : "NO") << '\n';
  }
}
