#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string a, b, s;
    cin >> a >> b >> s;
    int cnt[26] = {0};
    if (b.length() < a.length()) {
      cout << "NO" << endl;
      continue;
    } else if (a.length() == b.length() && a != b) {
      cout << "NO" << endl;
      continue;
    }
    for (int i = 0; i < s.length(); i++) {
      cnt[s[i] - 97]++;
    }
    int i = 0;
    int j = 0;
    int count = 0;
    while (i < a.length() && j < b.length()) {
      if (a[i] == b[j]) {
        i++;
        j++;
      } else if (cnt[b[j] - 97] > 0) {
        cnt[b[j] - 97]--;
        j++;
      } else if (cnt[b[j] - 97] <= 0) {
        cout << "NO" << endl;
        count++;
        break;
      }
    }
    if (count > 0)
      continue;
    else if (i == a.length() && j == b.length()) {
      cout << "YES" << endl;
      continue;
    }
    if (i != a.length())
      cout << "NO" << endl;
    else if (j < b.length()) {
      int count1 = 0;
      while (j < b.length()) {
        if (cnt[b[j] - 97] > 0) {
          cnt[b[j] - 97]--;
          j++;
        } else {
          cout << "NO" << endl;
          count1++;
          break;
        }
      }
      if (count1 == 0) cout << "YES" << endl;
    }
  }
  return 0;
}
