#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s, t, p;
    cin >> s;
    cin >> t;
    cin >> p;
    int ns = s.length();
    int nt = t.length();
    int np = p.length();
    int z = 0;
    int a = 0;
    for (int i = 0; i < nt; i++) {
      if (s[z] == t[i]) {
        z++;
      }
      if (z == ns) {
        a = 1;
        break;
      }
    }
    if (a == 1) {
      unordered_map<char, int> mpt;
      for (int i = 0; i < nt; i++) {
        mpt[t[i]]++;
      }
      for (int i = 0; i < ns; i++) {
        if (mpt.find(s[i]) != mpt.end()) {
          mpt[s[i]]--;
          if (mpt[s[i]] == 0) {
            mpt.erase(s[i]);
          }
        }
      }
      if (mpt.size() == 0) {
        cout << "Yes" << endl;
      } else {
        for (int i = 0; i < np; i++) {
          if (mpt.find(p[i]) != mpt.end()) {
            mpt[p[i]]--;
            if (mpt[p[i]] == 0) {
              mpt.erase(p[i]);
            }
          }
        }
        if (mpt.size() == 0) {
          cout << "Yes" << endl;
        } else {
          cout << "No" << endl;
        }
      }
    } else {
      cout << "No" << endl;
    }
  }
}
