#include <bits/stdc++.h>
using namespace std;
const int M = 105;
int n, m, k;
char s[M], t[M], p[M];
int Cnt[128], Ned[128];
bool Check() {
  int pos = 1;
  for (int i = 1; i <= m; i++) {
    if (pos <= n and t[i] == s[pos])
      pos++;
    else
      Ned[(int)t[i]]++;
  }
  if (pos <= n) return false;
  for (int i = 1; i <= k; i++) Cnt[(int)p[i]]++;
  for (int i = 'a'; i <= 'z'; i++)
    if (Cnt[i] < Ned[i]) return false;
  return true;
}
void Solve() {
  for (int i = 'a'; i <= 'z'; i++) Cnt[i] = Ned[i] = 0;
  puts(Check() ? "YES" : "NO");
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%s%s%s", s + 1, t + 1, p + 1);
    n = strlen(s + 1);
    m = strlen(t + 1);
    k = strlen(p + 1);
    Solve();
  }
  return 0;
}
