#include <bits/stdc++.h>
using namespace std;
int bst(int a[], int lw, int hi, int n) {
  int mid = (lw + hi) / 2;
  if (lw > hi) return -1;
  if (a[mid] > n)
    bst(a, lw, mid - 1, n);
  else if (a[mid] < n)
    bst(a, mid + 1, hi, n);
  else
    return mid;
}
void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  int i, j, k;
  i = k = 0;
  vector<int> v(26);
  while (i < a.size()) {
    while (a[i] != b[k]) {
      k++;
      if (k == b.size()) {
        cout << "NO\n";
        return;
      }
    }
    a[i] = b[k] = '.';
    i++;
  }
  k = 0;
  while (k < b.size()) {
    if (b[k] != '.') v[b[k] - 'a']--;
    k++;
  }
  k = 0;
  while (k < c.size()) {
    v[c[k] - 'a']++;
    k++;
  }
  for (int i = 0; i < 26; i++)
    if (v[i] < 0) {
      cout << "NO\n";
      return;
    }
  cout << "YES\n";
}
int main() {
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
