#include <bits/stdc++.h>
const int minINF = 1e5;
const int INF = 1e9;
const long long INFL = 1e18;
const int MAX = 1e5 + 100;
bool prime(int n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  for (int x = 2; x * x <= n; x++) {
    if (n % x == 0) return false;
  }
  return true;
}
using namespace std;
int idir[] = {-1, 0, 1, 0};
int jdir[] = {0, 1, 0, -1};
int main() {
  int q;
  cin >> q;
  int cnt[30];
  for (int i = 0; i < q; i++) {
    string s, t, p;
    cin >> s >> t >> p;
    memset(cnt, 0, sizeof(cnt));
    ;
    bool flag = false;
    for (auto x : p) {
      cnt[x - 'a']++;
    }
    int k = 0, it = 0;
    while (k < s.size()) {
      if (it == t.size()) {
        flag = true;
        break;
      }
      if (s[k] == t[it]) {
        k++;
        it++;
        continue;
      }
      --cnt[t[it] - 'a'];
      it++;
    }
    while (it < t.size()) {
      cnt[t[it] - 'a']--;
      it++;
    }
    if (*min_element(cnt, cnt + 30) < 0) {
      flag = true;
    }
    if (flag)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
