#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e4 + 5;
int q;
string s, t, p;
int cnt[30], cnt2[30];
int main() {
  ios::sync_with_stdio(0);
  cin >> q;
  while (q--) {
    memset(cnt, 0, sizeof(cnt));
    memset(cnt2, 0, sizeof(cnt2));
    cin >> s >> t >> p;
    set<int> e;
    int idx = 0;
    for (int i = 0; idx < s.length() && i < t.length(); ++i) {
      if (t[i] == s[idx]) {
        e.insert(i);
        ++idx;
      }
    }
    if (idx < s.length()) {
      cout << "NO\n";
      continue;
    }
    for (int i = 0; i < t.length(); ++i) {
      if (e.count(i)) {
        continue;
      }
      ++cnt[t[i] - 'a'];
    }
    for (int i = 0; i < p.length(); ++i) {
      ++cnt2[p[i] - 'a'];
    }
    bool flag = 0;
    for (int i = 0; i < 26; ++i) {
      if (cnt[i] > cnt2[i]) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
  }
  return 0;
}
