#include <bits/stdc++.h>
long long ans, dm, i;
using namespace std;
void kd() {
  string s, t, p;
  cin >> s >> t >> p;
  int l1 = s.length();
  int l2 = t.length();
  int l3 = p.length();
  int h1[26] = {0}, h2[26] = {0}, h3[26] = {0};
  for (int i = 0; i < l1; i++) h1[s[i] - 97]++;
  for (int j = 0; j < l2; j++) h2[t[j] - 97]++;
  for (int k = 0; k < l3; k++) h3[p[k] - 97]++;
  int j = 0;
  for (int i = 0; i < l2; i++) {
    if (t[i] == s[j]) {
      j++;
    }
  }
  if (j == l1) {
    int fl = 0;
    for (int i = 0; i < 26; i++) {
      if (h1[i] < h2[i]) {
        if (h3[i] < (h2[i] - h1[i])) {
          fl = 1;
          break;
        }
      }
      if (h1[i] > h2[i]) {
        fl = 1;
        break;
      }
    }
    if (fl == 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    kd();
  }
  return 0;
}
