#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    vector<long long> v;
    long long k = 0, flag = 0, a[200000], m = 0, flag1 = 0, flag2 = 0,
              flag3 = 1, b[26] = {0}, c[26] = {0};
    string s, t, p;
    cin >> s;
    cin >> t;
    cin >> p;
    sort(p.begin(), p.end());
    if (s.size() > t.size())
      cout << "NO" << '\n';
    else if (s.size() == t.size()) {
      for (long long i = 0; i < s.size(); i++) {
        if (s[i] == t[i])
          flag = 1;
        else {
          flag = 0;
          break;
        }
      }
      if (flag == 0)
        cout << "NO" << '\n';
      else {
        cout << "YES" << '\n';
      }
    } else {
      long long i, j;
      for (i = 0; i < s.size(); i++) {
        for (j = k; j < t.size(); j++) {
          if (s[i] == t[j]) {
            flag = 1;
            a[m] = j;
            m++;
            k = j + 1;
            break;
          } else {
            flag = 0;
          }
        }
        if (flag == 0 || j == t.size()) break;
      }
      if (flag == 0 || ((k >= t.size()) && (i != s.size())))
        cout << "NO" << '\n';
      else {
        for (long long i = 1; i < m; i++) {
          if (a[i] > a[i - 1])
            flag3 = 1;
          else {
            flag3 = 0;
            break;
          }
        }
        if (flag3 == 0)
          cout << "NO" << '\n';
        else {
          for (long long i = 0; i < m; i++) {
            v.push_back(a[i]);
          }
          sort(v.begin(), v.end());
          for (long long i = 0; i < t.size(); i++) {
            if (binary_search(v.begin(), v.end(), i)) {
              flag1 = 0;
            } else {
              flag1 = 1;
              b[t[i] - 'a']++;
            }
          }
          for (long long i = 0; i < p.size(); i++) {
            c[p[i] - 'a']++;
          }
          for (long long i = 0; i < 26; i++) {
            if (c[i] >= b[i]) {
              flag2 = 1;
            } else {
              flag2 = 0;
              break;
            }
          }
          if (flag2 == 0)
            cout << "NO" << '\n';
          else if (flag2 == 1) {
            cout << "YES" << '\n';
          }
        }
      }
    }
  }
}
