#include <bits/stdc++.h>   using namespace std;   #pragma GCC target( avx2 )   #pragma GCC optimization( O3 )   #pragma GCC optimization( unroll-loops )   bool check(string pattern, string text) {     int j = 0;     int i = 0;     while (i < text.size()) {       if (pattern[j] == text[i]) {         j++;       }       i++;     }     return j == pattern.size();   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int d;     cin >> d;     while (d--) {       string s, t, p;       cin >> s >> t >> p;       string k = s;       s = s + p;       map<char, long long int> m_s;       map<char, long long int> m_t;       for (int i = 0; i < s.size(); ++i) {         m_s[s[i]]++;       }       for (int i = 0; i < t.size(); ++i) {         m_t[t[i]]++;       }       bool checks = true;       for (auto i : m_t) {         if (m_s[i.first] < i.second) {           checks = false;         }       }       if (checks && check(k, t)) {         cout <<  YES               <<   n ;       } else {         cout <<  NO               <<   n ;       }     }   }   