#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t, p;
  long long int temp, q, i, x, y, z, j, temp2;
  cin >> q;
  while (q--) {
    temp = 0;
    temp2 = 0;
    cin >> s >> t >> p;
    x = s.size();
    y = t.size();
    z = p.size();
    vector<long long int> s1(26, 0), t1(26, 0), p1(26, 0);
    for (i = 0; i < x; i++) {
      s1[s[i] - 'a']++;
    }
    for (i = 0; i < y; i++) {
      t1[t[i] - 'a']++;
    }
    for (i = 0; i < z; i++) {
      p1[p[i] - 'a']++;
    }
    for (i = 0; i < 26; i++) {
      if (s1[i] > t1[i] || s1[i] + p1[i] < t1[i]) {
        temp = 1;
        break;
      }
    }
    j = 0;
    for (i = 0; i < y; i++) {
      if (t[i] == s[j]) {
        j++;
      }
      if (j == x) {
        break;
      }
    }
    if (j != x) {
      temp2 = 1;
    }
    if (temp == 1 || temp2 == 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
}
