#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX = 105;
bool isUse[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int Q;
  cin >> Q;
  for (int q = 0; q < Q; q++) {
    string p, s, t;
    cin >> s >> t >> p;
    memset(isUse, 0, sizeof(isUse));
    int lastIdx = 0;
    map<char, int> m;
    for (int i = 0; i < s.size(); i++) {
      bool isFind = false;
      for (int j = lastIdx; j < t.size(); j++) {
        if (s[i] == t[j]) {
          isUse[j] = true;
          lastIdx = j + 1;
          isFind = true;
          break;
        }
      }
      if (!isFind) goto NO;
    }
    for (int i = 0; i < t.size(); i++) {
      if (!isUse[i]) m[t[i]]++;
    }
    for (int i = 0; i < p.size(); i++) {
      if (m.find(p[i]) != m.end()) {
        m[p[i]]--;
      }
    }
    for (auto p : m) {
      if (p.second > 0) goto NO;
    }
    cout << "YES\n";
    continue;
  NO:
    cout << "NO\n";
  }
}
