#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   int m, n, q, x;   int ans;   int a[N], b[N];   char s[N], p[N], t[N];   int main() {     int T;     scanf( %d , &T);     while (T--) {       int pt1, pt2;       pt1 = pt2 = 0;       memset(a, 0, sizeof(a));       memset(b, 0, sizeof(b));       cin >> s >> t >> p;       int f = 0;       int lens = strlen(s);       int lenp = strlen(p);       int lent = strlen(t);       for (pt2 = 0; pt2 < lent; pt2++) {         if (s[pt1] == t[pt2]) {           pt1++;         } else           b[t[pt2] -  a ]++;       }       if (pt1 < lens) {         cout <<  NO  << endl;         continue;       }       for (int i = 0; i < lenp; i++) a[p[i] -  a ]++;       for (int i = 0; i < 26; i++) {         if (b[i] > a[i]) {           f = 1;           cout <<  NO  << endl;           break;         }       }       if (f == 0) cout <<  YES  << endl;     }     return 0;   }   