#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, i;
  cin >> t;
  while (t--) {
    int flag = 0;
    string s, t, p;
    cin >> s >> t >> p;
    int a[26] = {0};
    if (s.length() > t.length()) {
      flag = 0;
    } else {
      for (i = 0; i < min(t.length(), s.length()) + 1; i++) {
        if (s[i] != t[i]) {
          for (int j = 0; j < p.length(); j++) {
            if (p[j] == t[i]) {
              string d = "";
              d = d + p[j];
              s.insert(i, d);
              p.erase(p.begin() + j);
              flag = 0;
              break;
            }
          }
          if (flag == 1) {
            cout << "NO\n";
            break;
          }
        }
      }
    }
    if (s == t && flag == 0)
      cout << "YES\n";
    else if (flag == 0)
      cout << "NO\n";
  }
}
