#include <bits/stdc++.h>
using namespace std;
int d[100], e[100], f[100];
char a[105], b[105], c[105];
int main() {
  int t, str;
  cin >> t;
  while (t--) {
    for (int i = 0; i < 28; i++) {
      d[i] = 0;
      e[i] = 0;
      f[i] = 0;
    }
    cin >> a >> b >> c;
    int str = 0, ends = 0, flag = 0;
    while (str != strlen(a)) {
      if (a[str] != b[ends]) {
        ends++;
      } else {
        str++;
        ends++;
      }
      if (ends == strlen(b)) break;
    }
    if (str != strlen(a))
      printf("NO\n");
    else {
      for (int i = 0; i < strlen(a); i++) {
        d[a[i] - 'a']++;
      }
      for (int i = 0; i < strlen(b); i++) {
        e[b[i] - 'a']++;
      }
      for (int i = 0; i < strlen(c); i++) {
        f[c[i] - 'a']++;
      }
      int stt = 0;
      for (int i = 0; i < 28; i++) {
        if (e[i] > d[i] + f[i]) {
          printf("NO\n");
          stt = 1;
          break;
        }
      }
      if (stt == 0) printf("YES\n");
    }
  }
}
