#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  for (int _ = 0; _ < q; _++) {
    vector<int> spchar(27, 0);
    vector<int> tchar(27, 0);
    string s, t, p;
    cin >> s >> t >> p;
    for (int i = 0; i < s.size(); i++) spchar[int(s[i] - 'a')]++;
    for (int i = 0; i < t.size(); i++) tchar[int(t[i] - 'a')]++;
    bool ok = true;
    int e = 0, k = 0;
    while (e < t.size() && k < s.size()) {
      if (s[k] == t[e]) k++;
      if (k == s.size())
        ;
      e++;
    }
    if (k != s.size()) {
      ok = false;
    }
    for (int i = 0; i < p.size(); i++) spchar[int(p[i] - 'a')]++;
    for (int i = 0; i < 27; i++)
      if (tchar[i] > spchar[i]) ok = false;
    if (ok)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
