#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr int MOD = 1000000007;
int main() {
  int q;
  cin >> q;
  while (q-- > 0) {
    string s, t, p;
    cin >> s >> t >> p;
    int sidx = 0;
    int tidx = 0;
    while (sidx < s.size() && tidx < t.size()) {
      if (s[sidx] == t[tidx]) {
        sidx++;
      }
      tidx++;
    }
    if (sidx < s.size()) {
      cout << "NO" << endl;
      continue;
    }
    vector<int> sc(26);
    vector<int> tc(26);
    vector<int> pc(26);
    for (int i = (0), i_end_ = (s.size()); i < i_end_; i++) sc[s[i] - 'a']++;
    for (int i = (0), i_end_ = (t.size()); i < i_end_; i++) tc[t[i] - 'a']++;
    for (int i = (0), i_end_ = (p.size()); i < i_end_; i++) pc[p[i] - 'a']++;
    bool flg = true;
    for (int i = (0), i_end_ = (26); i < i_end_; i++) {
      if (sc[i] + pc[i] < tc[i]) {
        flg = false;
        break;
      }
    }
    if (flg) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
