#include<bits/stdc++.h>
using namespace std;
int q;
string s,t,p;
int viss[30];
int vist[30];
int visp[30];
int main()
{
	cin>>q;
	while(q--)
	{
		int flag=0;
		memset(viss,0,sizeof(viss));
		memset(vist,0,sizeof(viss));
		memset(visp,0,sizeof(viss));
		cin>>s>>t>>p;
		for(int i=0;i<s.length();i++)
		viss[s[i]-'a']++;//0-25
		for(int i=0;i<t.length();i++)
		vist[t[i]-'a']++;//0
		for(int i=0;i<p.length();i++)
		visp[p[i]-'a']++;//0

		for(int i=0;i<=25;i++)
		{
			if(viss[i]!=0&&vist[i]!=0&&viss[i]>vist[i])
			{
				cout<<"NO"<<endl;
				flag=1;
				break;
			}
		}

		for(int i=0;i<=25;i++)
		{
			if(viss[i]!=0&&vist[i]==0)
			{
				cout<<"NO"<<endl;
				flag=1;
				break;
			}
		}

		for(int i=0;i<=25;i++)
		{
			if(viss[i]==0&&vist[i]!=0&&visp[i]==0)
			{
				cout<<"NO"<<endl;
				flag=1;
				break;
			}
		}
			for(int i=0;i<=25;i++)
		{
			if(viss[i]!=0&&vist[i]!=0&&visp[i]!=0&&viss[i]+visp[i]<vist[i])
			{
				cout<<"NO"<<endl;
				flag=1;
				break;
			}
		}
		int pos=t.find(s[0]);
		for(int i=1;i<s.length();i++)
		{
			if(pos>t.find(s[i]))
			{
				cout<<"NO"<<endl;
				flag=1;
				break;
			}
			else
			pos=t.find(s[i]);
		}
		if(flag==0)
		cout<<"YES"<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int q;
string s,t,p;
int counts[30];
int countt[30];
int countp[30];
int vis[30];
int main()
{
	cin>>q;
	while(q--)
	{
		int flag=0;
		memset(counts,0,sizeof(counts));
		memset(countt,0,sizeof(countt));
		memset(countp,0,sizeof(countp));
		memset(vis,0,sizeof(vis));
		cin>>s>>t>>p;
		for(int i=0;i<s.length();i++)
		counts[s[i]-'a']++;//0-25
		for(int i=0;i<t.length();i++)
		countt[t[i]-'a']++;//0
		for(int i=0;i<p.length();i++)
		countp[p[i]-'a']++;//0

		for(int i=0;i<=25;i++)
		{
			if(counts[i]>countt[i])
			{
				cout<<"NO"<<endl;
				flag=1;
				break;
			}
		}
			for(int i=0;i<=25;i++)
		{
			if(counts[i]+countp[i]<countt[i]&&flag!=1)
			{
				cout<<"NO"<<endl;
				flag=2;
				break;
			}
		}
		int pos=t.find(s[0]);
		vis[s[0]-'a']=1;
		for(int i=1;i<s.length();i++)
		{
			if(pos>t.find(s[i])&&vis[s[i]-'a']==0&&t.find(s[i])!=t.npos&&flag!=1&&flag!=2)
			{
				cout<<"NO"<<endl;
				flag=3;
				break;
			}
			else
			{
			pos=t.find(s[i]);
			vis[s[i]-'a']=1;
		    }
		}
		if(flag==0)
		cout<<"YES"<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
cout << endl;
int tfreq[26]={0};
while(t--){
    string s,t,p;
    cin >> s >>t>>p;
    int j=0;
    int n=t.size();
    bool flag=true;

    for(int i=0;i<n;i++){
        if(t[i]==s[j])
            j++;
            else{
                tfreq[t[i]-'a']++;
            }
    }
    if(j!=s.size())
		{
		flag=false;
		cout<<"NO"<<endl;
		continue;
		}
    for(int i=0;i<p.size();i++){
        if(tfreq[p[i]-'a']>0)
            tfreq[p[i]-'a']--;
    }
    for(int i=0;i<26;i++)
		{
			if(tfreq[i]>0)
			flag=false;
		}
		if(flag)
		cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
cout << endl;
int tfreq[26]={0};
while(t--){
    string s,t,p;
    cin >> s >>t>>p;
    int j=0;
    int n=t.size();
    bool flag=true;
    if(j!=s.size())
		{
		flag=false;
		cout<<"NO"<<endl;
		continue;
		}
    for(int i=0;i<n;i++){
        if(t[i]==s[j])
            j++;
            else{
                tfreq[t[i]-'a']++;
            }
    }
    for(int i=0;i<p.size();i++){
        if(tfreq[p[i]-'a']>0)
            tfreq[p[i]-'a']--;
    }
    for(int i=0;i<26;i++)
		{
			if(tfreq[i]>0)
			flag=false;
		}
		if(flag)
		cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
cout << endl;
int tfreq[26]={0};
while(t--){
   string s,t,p;
		cin >> s >> t >> p;
		int j=0;
		int tfreq[26]={0};
		for(int i=0;i<t.size();i++){

			if(t[i]==s[j])
			{
				j++;
			}
			else
			tfreq[t[i]-'a']++;
		}
		bool flag=true;
		if(j!=s.size())
		{
		flag=false;
		cout<<"NO"<<endl;
		continue;
		}
		for(int i=0;i<p.size();i++){
			if(tfreq[p[i]-'a']>0)
			tfreq[p[i]-'a']--;
		}
		for(int i=0;i<26;i++)
		{
			if(tfreq[i]>0)
			flag=false;
		}
		if(flag)
		cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;

	}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
cout << endl;
while(t--){
    string s,t,p;
    cin >> s >>t>>p;
    int n=t.size();
    int i=0;
    while(i<n){
            int j=0;
        if(t[i]==s[i])
            i++;
        else{
            for( j=0;j<p.size();j++){
                if(t[i]==p[j]){
                    i++;
                    break;
            }
        }
        if(j==p.size())
        {
            cout <<"NO"<<endl;
            return 0 ;
        }
    }
    i++;
}
cout <<"YES"<<endl;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
cout << endl;
int tfreq[26]={0};
while(t--){
    string s,t,p;
    cin >> s >>t>>p;
    int j=0;
    int n=t.size();
    bool flag=true;
    for(int i=0;i<n;i++){
        if(t[i]==s[j])
            j++;
            else{
                tfreq[t[i]-'a']++;
            }
    }
    for(int i=0;i<p.size();i++){
        if(tfreq[p[i]-'a']>0)
            tfreq[p[i]-'a']--;
    }
    for(int i=0;i<26;i++)
		{
			if(tfreq[i]>0)
			flag=false;
		}
		if(flag)
		cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
}

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
cout << endl;
while(t--){
    string s,t,p;
    cin >> s >>t>>p;
    int n=t.size();
    int i=0;
    int pl=p.size();
    while(i<n){
            int j=0;
        if(t[i]==s[i])
            i++;
        else{
            for( j=0;j<pl;j++){
                if(t[i]==p[j]){
                        p.erase(p.begin()+j);
                    i++;
                    break;
                pl--;
            }
        }
        if(j==p.size())
        {
            cout <<"NO"<<endl;
            return 0 ;
        }
    }
    i++;
}
cout <<"YES"<<endl;
}
return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        string s,t,p,s1;
        cin>>s;
        cin>>t;
        cin>>p;
        int i,j;
        map<char,int>letter;
       if(s.length()==t.length())
       {
           if(s==t)
               cout<<"YES"<<endl;
               else
               cout<<"NO"<<endl;
         return ;
       }
       if(s.length()>t.length())
       cout<<"NO"<<endl;
       else
       {
            for(i=0;i<p.length();i++)
           letter[p[i]]++;
           i=0; j=0;
          while(j<t.length())
         {
        if(i<s.length() && s[i]==t[j])
        {
            i++;
            j++;
        }
        else
        {
            if(letter[t[j]]>0)
            {
                letter[t[j]]--;
                j++;
            }
            else
                break;
        }
    }
    if(i==s.length() && j==t.length())
        cout<<"YES\n";
    else
        cout<<"NO\n";
    }

    }
    //cout<<"Hello World";

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        string s,t,p,s1;
        cin>>s;
        cin>>t;
        cin>>p;
        int i,j;
        map<char,int>letter;
       if(s.length()==t.length())
       {
           if(s==t)
               cout<<"YES"<<endl;
               else
               cout<<"NO"<<endl;
         return;
       }
       if(s.length()>t.length())
       cout<<"NO"<<endl;
       else
       {
            for(i=0;i<p.length();i++)
           letter[p[i]]++;
           i=0; j=0;
          while(j<t.length())
         {
        if(i<s.length() && s[i]==t[j])
        {
            i++;
            j++;
        }
        else
        {
            if(letter[t[j]]>0)
            {
                letter[t[j]]--;
                j++;
            }
            else
                break;
        }
    }
    if(i==s.length() && j==t.length())
        cout<<"YES\n";
    else
        cout<<"NO\n";
    }

    }
    //cout<<"Hello World";

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        string s,t,p,s1;
        cin>>s;
        cin>>t;
        cin>>p;
        int i,j,k,flag=0;
        if(s[0]!=t[0])
        {
            for(i=0;i<p.length();i++)
            {
                if(p[i]==s[0])
                {
                  flag=1;
                  break;
                }
            }
        }
          if(flag==0 && s[0]!=t[0])
        cout<<"NO"<<endl;
        else{
            flag=0;
        if(s[s.length()-1]!=t[t.length()-1])
        {
            for(i=0;i<p.length();i++)
            {
                if(p[i]==s[s.length()-1])
                {
                  flag=1;
                  break;
                }
            }
        }
        if(flag==0 && s[s.length()-1]!=t[t.length()-1])
        cout<<"NO"<<endl;
        else{
        for(i=0;i<s.length();i++){
            flag=0;
           for(j=0;j<t.length();j++)
           {
               if(s[i]==t[j])
               {
                 //cout<<s[i]<<" "<<t[j]<<endl;
                   flag=1;
                   t[j]='1';
                   break;
               }
           }
           if(flag==0)
           {
               break;
           }
        }
    //    cout<<flag<<endl;
        if(flag==0)
        cout<<"NO"<<endl;
        else{
        for(j=0;j<t.length();j++)
           {
               if(t[j]!='1')
               {
                   s1+=t[j];
               }
           }
           for(i=0;i<s1.length();i++)
           {
               flag=0;
               for(j=0;j<p.length();j++)
               {
                   if(s1[i]==p[j])
                   {
                       p[j]='1';
                       flag=1;
                       break;
                   }
               }
               if(flag==0)
               break;
           }
           if(flag==0)
           cout<<"NO"<<endl;
           else
           cout<<"YES"<<endl;
        }
        }
        }

    }
    //cout<<"Hello World";

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        string s,t,p,s1;
        cin>>s;
        cin>>t;
        cin>>p;
        int i,j;
        map<char,int>letter;
       if(s.length()==t.length())
       {
           if(s==t)
               cout<<"YES"<<endl;
               else
               cout<<"NO"<<endl;
       }
       if(s.length()>t.length())
       cout<<"NO"<<endl;
       else
       {
            for(i=0;i<p.length();i++)
           letter[p[i]]++;
           i=0; j=0;
          while(j<t.length())
         {
        if(i<s.length() && s[i]==t[j])
        {
            i++;
            j++;
        }
        else
        {
            if(letter[t[j]]>0)
            {
                letter[t[j]]--;
                j++;
            }
            else
                break;
        }
    }
    if(i==s.length() && j==t.length())
        cout<<"YES\n";
    else
        cout<<"NO\n";
    }

    }
    //cout<<"Hello World";

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        string s,t,p,s1;
        cin>>s;
        cin>>t;
        cin>>p;
        int i,j;
        map<char,int>letter;
       if(s.length()==t.length())
       {
           if(s==t)
               cout<<"YES"<<endl;
               else
               cout<<"NO"<<endl;
       }
       else{
       if(s.length()>t.length())
       cout<<"NO"<<endl;
       else
       {
            for(i=0;i<p.length();i++)
           letter[p[i]]++;
           i=0; j=0;
          while(j<t.length())
         {
        if(i<s.length() && s[i]==t[j])
        {
            i++;
            j++;
        }
        else
        {
            if(letter[t[j]]>0)
            {
                letter[t[j]]--;
                j++;
            }
            else
                break;
        }
    }
    if(i==s.length() && j==t.length())
        cout<<"YES\n";
    else
        cout<<"NO\n";
    }
    }
    }
    //cout<<"Hello World";

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		string :: iterator y;
		map<char, int> mp;
		map<char, int> :: iterator it;
		cin >> s >> t >> p ;
		if(s == t){
			cout << "YES" << endl;
			continue;
		}
		if(s.size() > t.size() || (s.size() == t.size() && s != t)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;
		//cout << s << endl << t << endl;
		ans = 1;
		FOR(i, 0, t.size()){
			//if(s[i] == t[i]) continue;
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else {
				if(mp[t[i]] >= 1){
					s.pb('c');
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if((s == t || ans) && s.size() == t.size()) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		string :: iterator y;
		map<char, int> mp;
		map<char, int> :: iterator it;
		cin >> s >> t >> p ;
		if(s.size() > p.size() || (s.size() == p.size() && s != p)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;
		//cout << s << endl << t << endl;
		ans = 1;
		FOR(i, 0, t.size()){
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else {
				if(mp[t[i]] >= 1){
					s.pb('c');
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if((s == t || ans) && s.size() == t.size()) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>          vll;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define PI                  (2.0*acos(0.0))
#define inf                 0x3f3f3f3f
#define INF                 0x3f3f3f3f3f3f3f3f
#define rev(v)              reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define si(n)               scanf("%d", &n)
#define sl(n)               scanf("%lld", &n)
#define sii(a, b)           scanf("%d %d", &a, &b)
#define sll(a, b)           scanf("%lld %lld", &a, &b)
#define siii(a, b, c)       scanf("%d %d %d", &a, &b, &c)
#define slll(a, b, c)       scanf("%lld %lld %lld", &a, &b, &c)
#define siiii(a, b, c, d)   scanf("%d %d %d %d", &a, &b, &c, &d)
#define sllll(a, b, c, d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl;}

int main(){
	#ifndef ONLINE_JUDGE
	    READ(); WRITE();
	#endif
	int t;
	si(t);

	while(t--){
		string s, t, p;
		int cnt[30];
		MEM(cnt, 0);

		cin >> s >> t >> p;
		FOR(i, 0, p.size()) ++cnt[p[i] - 'a'];

		int m = 0, n = 0, ans = 1;
		while(m < s.size()){
			if(n == t.size()){
				ans = 0;
				break;
			}

			if(s[m] == t[n]){
				++m, ++n;
				continue;
			}

			--cnt[t[n] - 'a'];
			++n;
		}
		while(n < t.size()){
			--cnt[t[n] - 'a'];
			++n;
		}
		if(*min_element(cnt, cnt + 30) < 0) ans = 0;
		pf("%s\n", ans ? "YES" : "NO");
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		string :: iterator y;
		map<char, int> mp;
		map<char, int> :: iterator it;
		cin >> s >> t >> p ;
		if(s.size() > p.size() || (s.size() == p.size() && s != p)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;
		//cout << s << endl << t << endl;
		FOR(i, 0, t.size()){
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else {
				if(mp[t[i]] >= 1){
					s.pb(t[i]);
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if(s == t) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		string :: iterator y;
		map<char, int> mp;
		map<char, int> :: iterator it;
		cin >> s >> t >> p ;
		if(s.size() > p.size() || (s.size() == p.size() && s != p)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;
		//cout << s << endl << t << endl;
		ans = 1;
		FOR(i, 0, t.size()){
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else {
				if(mp[t[i]] >= 1){
					//s.pb(t[i]);
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if(s == t || ans) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		string :: iterator y;
		map<char, int> mp;
		map<char, int> :: iterator it;
		cin >> s >> t >> p ;
		if(s == t){
			cout << "YES" << endl;
			continue;
		}
		if(s.size() > p.size() || (s.size() == p.size() && s != p)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;
		//cout << s << endl << t << endl;
		ans = 1;
		FOR(i, 0, t.size()){
			//if(s[i] == t[i]) continue;
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else {
				if(mp[t[i]] >= 1){
					s.pb('c');
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if((s == t || ans) && s.size() == t.size()) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		string :: iterator y;
		map<char, int> mp;
		map<char, int> :: iterator it;
		cin >> s >> t >> p ;
		if(s == t || s.size() > p.size() || (s.size() == p.size() && s != p)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;
		//cout << s << endl << t << endl;
		ans = 1;
		FOR(i, 0, t.size()){
			//if(s[i] == t[i]) continue;
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else {
				if(mp[t[i]] >= 1){
					s.pb('c');
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if((s == t || ans) && s.size() == t.size()) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		map<char, int> mp;
		cin >> s >> t >> p ;

		if(s == t){
			cout << "YES" << endl;
			continue;
		}
		if(s.size() > t.size() || (s.size() == t.size() && s != t)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;

		ans = 1;
		FOR(i, 0, t.size()){
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else if(s[i] != t[i]) {
				if(mp[t[i]] >= 1){
					s.pb('c');
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if(s == t || ans) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long           ll;
typedef vector<int>         vi;
typedef vector<ll>         	vll;

#define sf(a)               scanf("%d", &a);
#define pf(a)               printf("%d\n", a);
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define rev(v)				reverse(all(v))
#define all(v)              v.begin(), v.end()
#define FOR(i, x, y)        for(int i = x; i < y; i++)
#define RFOR(i, x, y)       for(int i = x; i >= y; i--)
#define MEM(arr, val)       memset(arr, val, sizeof(arr));
#define unq(v)              (v).resize(unique(all(v)) - v.begin())
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define vout(v)             for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout << ' '; else cout << endl; }

int main(){
	ll t, n, m, ans = 999999999;
	cin >> t;

	while(t--){
		string s, t, p;
		map<char, int> mp;
		cin >> s >> t >> p ;

		if(s == t){
			cout << "YES" << endl;
			continue;
		}
		if(s.size() > t.size() || (s.size() == t.size() && s != t)){
			cout << "NO" << endl;
			continue;
		}
		FOR(i, 0, p.size()) mp[p[i]]++;

		ans = 1;
		FOR(i, 0, t.size()){
			if(i < s.size()){
				if(s[i] != t[i]){
					if(mp[t[i]] >= 1){
						s.insert(i, 1, t[i]);
					} else {
						ans = 0;
						break;
					}
				}
			} else if(s[i] != t[i]) {
				if(mp[t[i]] >= 1){
					s.pb('c');
					mp[t[i]]--;
				} else {
					ans = 0;
					break;
				}
			}
		}

		//cout << endl << s << endl << t << endl;
		if((s == t || ans) && s.size() == t.size()) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

    return 0;
}


#include<bits/stdc++.h>

#define loca
#define debu
using namespace std;

const int MAXN = 500005;
const int INF = 0x3f3f3f3f;

char s[105], t[105], p[105];
int hsh1[26 + 5], hsh2[26 + 5];

long long n, m, T;

/** 解二:时间复杂度为O(n) */
template<class T>
bool IsSubSequence(T a[], int a_len, T b[], int b_len) {
    int i = 0;
    int j = 0;
    if (a_len > b_len) return false;
    while (i < a_len) {
        if (a[i] == b[j]) /** 相等时，下标同时向后移动一个位置. */
        {
            i++, j++;
        } else {
            j++;  /** 不等时,只将b[]数组下标向后移动一个位置. */
            if (j == b_len)  /** 当b[]数组找完时，指向了第m+1个不存在的元素，则不符合。 */
                return false;
        }
    }
    return true;
}

int main() {

#ifdef local
    freopen("testdata.in", "r+", stdin);
    freopen("testdata.out", "w+", stdout);
#endif // local

    //ios::sync_with_stdio(false);

    cin >> T;
    while (T--) {
        memset(hsh1, 0, sizeof(hsh1)), memset(hsh2, 0, sizeof(hsh2));

        scanf("%s%s%s", s, t, p);
        if (!IsSubSequence(s, strlen(s), t, strlen(t))) {
            cout << "NO" << endl;
            continue;
        } else {
            for (int i = 0; i < strlen(s); i++)
                hsh1[s[i] - 'a']++;
            for (int i = 0; i < strlen(t); i++)
                hsh2[t[i] - 'a']++;
            for (int i = 0; i < strlen(p); i++)
                hsh1[p[i] - 'a']++;
            bool flg = true;
            for (int i = 0; i <= 26; i++) {
                if (hsh1[i] >= hsh2[i]) continue;
                else {
                    flg = false;
                    break;
                }
            }
            if (flg)
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>

#define loca
#define debu
using namespace std;

const int MAXN = 500005;
const int INF = 0x3f3f3f3f;

char s[105], t[105], p[105];
int hsh1[26 + 5], hsh2[26 + 5];

long long n, m, T;

template <class T>
bool IsSubSequence(T a[], int n, T b[], int m) {
    int t;
    t = 0;
    for (int i=0; i<n; i++) {

        for (int j=t;; j++) {

            if (a[i]==b[j]) {
                /**
                 找到，记住j位置，下一次从j+1开始.
                 */
                t=j+1;
                break;
            }

            if (j>=m)
                /**
                 没有找到，所以不是子序列。
                 */
                return false;
        }
    }
    return true;
    /**
     全部比较完，都已经找到。
     */
}

int main() {

#ifdef local
    freopen("testdata.in", "r+", stdin);
    freopen("testdata.out", "w+", stdout);
#endif // local

    //ios::sync_with_stdio(false);

    cin >> T;
    while (T--) {
        memset(hsh1, 0, sizeof(hsh1)), memset(hsh2, 0, sizeof(hsh2));

        scanf("%s%s%s", s, t, p);
        if (!IsSubSequence(s, strlen(s), t, strlen(t))) {
            cout << "NO" << endl;
            continue;
        } else {
            for (int i = 0; i < strlen(s); i++)
                hsh1[s[i] - 'a']++;
            for (int i = 0; i < strlen(t); i++)
                hsh2[t[i] - 'a']++;
            for (int i = 0; i < strlen(p); i++)
                hsh1[p[i] - 'a']++;
            bool flg = true;
            for (int i = 0; i <= 26; i++) {
                if (hsh1[i] >= hsh2[i]) continue;
                else {
                    flg = false;
                    break;
                }
            }
            if (flg)
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>

#define loca
#define debu
using namespace std;

const int MAXN = 500005;
const int INF = 0x3f3f3f3f;

char s[105], t[105], p[105];
int hsh1[26 + 5], hsh2[26 + 5];

long long n, m, T;

/** 解二:时间复杂度为O(n) */
template<class T>
bool IsSubSequence(T a[], int a_len, T b[], int b_len) {
    int i = 0;
    int j = 0;
    while (i < a_len) {
        if (a[i] == b[j]) /** 相等时，下标同时向后移动一个位置. */
        {
            i++, j++;
        } else {
            j++;  /** 不等时,只将b[]数组下标向后移动一个位置. */
            if (j == b_len)  /** 当b[]数组找完时，指向了第m+1个不存在的元素，则不符合。 */
                return false;
        }
    }
    return true;
}

int main() {

#ifdef local
    freopen("testdata.in", "r+", stdin);
    freopen("testdata.out", "w+", stdout);
#endif // local

    //ios::sync_with_stdio(false);

    cin >> T;
    while (T--) {
        memset(hsh1, 0, sizeof(hsh1)), memset(hsh2, 0, sizeof(hsh2));

        scanf("%s%s%s", s, t, p);
        if (!IsSubSequence(s, strlen(s), t, strlen(t))) {
            cout << "NO" << endl;
            continue;
        } else {
            for (int i = 0; i < strlen(s); i++)
                hsh1[s[i] - 'a']++;
            for (int i = 0; i < strlen(t); i++)
                hsh2[t[i] - 'a']++;
            for (int i = 0; i < strlen(p); i++)
                hsh1[p[i] - 'a']++;
            bool flg = true;
            for (int i = 0; i <= 26; i++) {
                if (hsh1[i] >= hsh2[i]) continue;
                else {
                    flg = false;
                    break;
                }
            }
            if (flg)
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>

#define loca
#define debu
using namespace std;

const int MAXN = 500005;
const int INF = 0x3f3f3f3f;

char s[105], t[105], p[105];
int hsh1[26 + 5], hsh2[26 + 5];

long long n, m, T, k;

#include <iostream>

/**
 解一：时间复杂度为O(n^2)
 设|a[n]|≤|b[m]|
 */
template <class T>
bool IsSubSequence(T a[], int n, T b[], int m) {
    int t;
    t = 0;
    for (int i=0; i<n; i++) {

        for (int j=t;; j++) {

            if (a[i]==b[j]) {
                /**
                 找到，记住j位置，下一次从j+1开始.
                 */
                t=j+1;
                break;
            }

            if (j>=m)
                /**
                 没有找到，所以不是子序列。
                 */
                return false;
        }
    }
    return true;
    /**
     全部比较完，都已经找到。
     */
}

int main() {

#ifdef local
    freopen("testdata.in", "r+", stdin);
    freopen("testdata.out", "w+", stdout);
#endif // local

    //ios::sync_with_stdio(false);

    cin >> T;
    while (T--) {
        cin >> n >> k;
        int res;
        res = n / k;
        n %= k;
        res += n / 3;
        if (res % 2 == 1)
            cout << "Bob" << endl;
        else
            cout << "Alice" << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    scanf("%d",&t);

    while (t--) {
        string s,t,p;
        cin >> s >> t >> p;
        if (s.length() > t.length()) {
            cout << "NO" << endl;
        }
        int pos = 0;
        int cnt[26];
        int sum = 0;
        memset(cnt,0,sizeof(cnt));
        for (int i=0;t[i];i++) {
            if (t[i] == s[pos]) {
                t.erase(i,1);
                pos++;
                if (!s[pos]) {
                    break;
                }
            }
        }
        sum = t.length();
        for (int i=0;t[i];i++) {
            cnt[t[i] - 'a']++;
        }

        for (int i=0;p[i] && sum;i++) {
            if (cnt[p[i] - 'a']) {
                cnt[p[i] - 'a']--;
                sum--;
            }
        }

        if (sum == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t,cnt = 1;
    scanf("%d",&t);

    while (t--) {
        string s,t,p;
        cin >> s >> t >> p;
        if (cnt == 29) {
            cout << s << endl << t << endl << p << endl;
            continue;
        }
        cnt++;
        if (s.length() > t.length()) {
            cout << "NO" << endl;
            continue;
        }
        int pos = 0;
        int cnt[26];
        int sum = 0;
        memset(cnt,0,sizeof(cnt));
        for (int i=0;t[i];i++) {
            if (t[i] == s[pos]) {
                t.erase(i,1);
                pos++;
                if (!s[pos]) {
                    break;
                }
            }
        }
        if (s[pos]) {
            cout << "NO" << endl;
            continue;
        }
        sum = t.length();
        for (int i=0;t[i];i++) {
            cnt[t[i] - 'a']++;
        }

        for (int i=0;p[i] && sum;i++) {
            if (cnt[p[i] - 'a']) {
                cnt[p[i] - 'a']--;
                sum--;
            }
        }

        if (sum == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t,cnt = 1;
    scanf("%d",&t);

    while (t--) {
        string s,t,p;
        cin >> s >> t >> p;
        if (cnt == 29) {
            cout << s.length() << endl << t << endl << p << endl;
            continue;
        }
        cnt++;
        if (s.length() > t.length()) {
            cout << "NO" << endl;
            continue;
        }
        int pos = 0;
        int cnt[26];
        int sum = 0;
        memset(cnt,0,sizeof(cnt));
        for (int i=0;t[i];i++) {
            if (t[i] == s[pos]) {
                t.erase(i,1);
                pos++;
                if (!s[pos]) {
                    break;
                }
            }
        }
        if (s[pos]) {
            cout << "NO" << endl;
            continue;
        }
        sum = t.length();
        for (int i=0;t[i];i++) {
            cnt[t[i] - 'a']++;
        }

        for (int i=0;p[i] && sum;i++) {
            if (cnt[p[i] - 'a']) {
                cnt[p[i] - 'a']--;
                sum--;
            }
        }

        if (sum == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    scanf("%d",&t);

    while (t--) {
        string s,t,p;
        cin >> s >> t >> p;
        if (s.length() > t.length()) {
            cout << "NO" << endl;
            continue;
        }
        int pos = 0;
        int cnt[26];
        int sum = 0;
        memset(cnt,0,sizeof(cnt));
        for (int i=0;t[i];i++) {
            if (t[i] == s[pos]) {
                t.erase(i,1);
                i--;
                pos++;
                if (!s[pos]) {
                    break;
                }
            }
        }
        if (s[pos]) {
            cout << "NO" << endl;
            continue;
        }
        sum = t.length();
        for (int i=0;t[i];i++) {
            cnt[t[i] - 'a']++;
        }

        for (int i=0;p[i] && sum;i++) {
            if (cnt[p[i] - 'a']) {
                cnt[p[i] - 'a']--;
                sum--;
            }
        }

        if (sum == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    scanf("%d",&t);

    while (t--) {
        string s,t,p;
        cin >> s >> t >> p;
        if (s.length() > t.length()) {
            cout << "NO" << endl;
            continue;
        }
        int pos = 0;
        int cnt[26];
        int sum = 0;
        memset(cnt,0,sizeof(cnt));
        for (int i=0;t[i];i++) {
            if (t[i] == s[pos]) {
                t.erase(i,1);
                pos++;
                if (!s[pos]) {
                    break;
                }
            }
        }
        if (s[pos]) {
            cout << "NO" << endl;
            continue;
        }
        sum = t.length();
        for (int i=0;t[i];i++) {
            cnt[t[i] - 'a']++;
        }

        for (int i=0;p[i] && sum;i++) {
            if (cnt[p[i] - 'a']) {
                cnt[p[i] - 'a']--;
                sum--;
            }
        }

        if (sum == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int t,cnts = 0;
    scanf("%d",&t);

    while (t--) {
        string s,t,p;
        cin >> s >> t >> p;
        cnts++;
        if (s.length() > t.length()) {
            if (cnts == 29) {
                cout << 1;
            }
            cout << "NO" << endl;
            continue;
        }
        int pos = 0;
        int cnt[26];
        int sum = 0;
        memset(cnt,0,sizeof(cnt));
        for (int i=0;t[i];i++) {
            if (t[i] == s[pos]) {
                t.erase(i,1);
                pos++;
                if (!s[pos]) {
                    break;
                }
            }
        }
        if (s[pos]) {
            if (cnts == 29) {
                cout << 2;
            }
            cout << "NO" << endl;
            continue;
        }
        sum = t.length();
        for (int i=0;t[i];i++) {
            cnt[t[i] - 'a']++;
        }

        for (int i=0;p[i] && sum;i++) {
            if (cnt[p[i] - 'a']) {
                cnt[p[i] - 'a']--;
                sum--;
            }
        }

        if (sum == 0) {
            cout << "YES" << endl;
        } else {
            if (cnts == 29) {
                cout << 3;
            }
            cout << "NO" << endl;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string a,final,xtra;
		cin >> a >> final >> xtra;
		map<char,int>mp,x,y;
		if(a==final)
		{
			cout << "YES" << endl;
			continue;
		}
		if(a.size()>final.size())
		{
			cout << "NO" << endl;
			continue;
		}
		if(a.size()==final.size() && a !=final)
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <a.size() ; ++i)
		{
			x[a[i]]++;
		}
		for (int i = 0; i < final.size(); ++i)
		{
			y[final[i]]++;
		}
		if(x.size()>y.size())
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <xtra.size(); ++i)
		{
			mp[xtra[i]]++;
		}
		int flag=0;
		int ck=0;
		for (int i = 0; i <final.size(); ++i)
		{
			if(y[a[ck]]==0 && ck<a.size())
			{
				//cout << ck << endl;
				//cout << a[ck] << endl;
				flag=1;
				cout << "NO" << endl;
					break;
			}
			if(a[ck] != final[i])
			{
				if(mp[final[i]]==0)
				{
					flag=1;
					cout << "NO" << endl;
					break;
				}
				else
					mp[final[i]]--;
			}
			else
				ck++;
		}
		if(!flag)
		{
			cout << "YES" << endl;
		}

	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string a,final,xtra;
		cin >> a >> final >> xtra;
		map<char,int>mp,x,y;
		if(a==final)
		{
			cout << "YES" << endl;
			continue;
		}
		if(a.size()>final.size())
		{
			cout << "NO" << endl;
			continue;
		}
		if(a.size()==final.size() && a !=final)
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <a.size() ; ++i)
		{
			x[a[i]]++;
		}
		for (int i = 0; i < final.size(); ++i)
		{
			y[final[i]]++;
		}
		if(x.size()>y.size())
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <xtra.size(); ++i)
		{
			mp[xtra[i]]++;
		}
		int flag=0;
		int ck=0,cp=0;
		for (int i = 0; i <final.size(); ++i)
		{
			if(y[a[ck]]==0 && ck<a.size())
			{
				//cout << ck << endl;
				//cout << a[ck] << endl;
				flag=1;
				cout << "NO" << endl;
					break;
			}
			if(a[ck] != final[i])
			{
				if(mp[final[i]]==0)
				{
					flag=1;
					cout << "NO" << endl;
					break;
				}
				else
					mp[final[i]]--,cp++;
			}
			else
				ck++;
		}
		if(cp+a.size()>final.size())
		{
			cout << "NO" << endl;
			continue;
		}
		if(!flag)
		{
			cout << "YES" << endl;
		}

	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string a,final,xtra;
		cin >> a >> final >> xtra;
		map<char,int>mp,x,y;
		if(a==final)
		{
			cout << "YES" << endl;
			continue;
		}
		if(a.size()>final.size())
		{
			cout << "NO" << endl;
			continue;
		}
		if(a.size()==finaAl.size() && a !=final)
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <a.size() ; ++i)
		{
			x[a[i]]++;
		}
		for (int i = 0; i < final.size(); ++i)
		{
			y[final[i]]++;
		}
		if(x.size()>y.size())
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <xtra.size(); ++i)
		{
			mp[xtra[i]]++;
		}
		int flag=0;
		int ck=0;
		for (int i = 0; i <final.size(); ++i)
		{
			if(a[ck] != final[i])
			{
				if(mp[final[i]]==0)
				{
					flag=1;
					cout << "NO" << endl;
					break;
				}
				else
					mp[final[i]]--;
			}
			else
				ck++;
		}
		if(!flag)
		{
			cout << "YES" << endl;
		}

	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string a,final,xtra;
		cin >> a >> final >> xtra;
		map<char,int>mp,x,y;
		if(a==final)
		{
			cout << "YES" << endl;
			continue;
		}
		if(a.size()>final.size())
		{
			cout << "NO" << endl;
			continue;
		}
		if(a.size()==final.size() && a !=final)
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <a.size() ; ++i)
		{
			x[a[i]]++;
		}
		for (int i = 0; i < final.size(); ++i)
		{
			y[final[i]]++;
		}
		if(x.size()>y.size())
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <xtra.size(); ++i)
		{
			mp[xtra[i]]++;
		}
		int flag=0;
		int ck=0;
		for (int i = 0; i <final.size(); ++i)
		{
			if(a[ck] != final[i])
			{
				if(mp[final[i]]==0)
				{
					flag=1;
					cout << "NO" << endl;
					break;
				}
				else
					mp[final[i]]--;
			}
			else
				ck++;
		}
		if(!flag)
		{
			cout << "YES" << endl;
		}

	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string a,final,xtra;
		cin >> a >> final >> xtra;
		map<char,int>mp,x,y;
		if(a==final)
		{
			cout << "YES" << endl;
			continue;
		}
		if(a.size()>final.size())
		{
			cout << "NO" << endl;
			continue;
		}
		if(a.size()==final.size() && a !=final)
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <a.size() ; ++i)
		{
			x[a[i]]++;
		}
		for (int i = 0; i < final.size(); ++i)
		{
			y[final[i]]++;
		}
		if(x.size()>y.size())
		{
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <xtra.size(); ++i)
		{
			mp[xtra[i]]++;
		}
		int flag=0;
		int ck=0;
		for (int i = 0; i <final.size(); ++i)
		{
			if(y[a[ck]]==0)
			{
				flag=1;
				cout << "NO" << endl;
					break;
			}
			if(a[ck] != final[i])
			{
				if(mp[final[i]]==0)
				{
					flag=1;
					cout << "NO" << endl;
					break;
				}
				else
					mp[final[i]]--;
			}
			else
				ck++;
		}
		if(!flag)
		{
			cout << "YES" << endl;
		}

	}
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <ctime>
#include <sstream>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define N 20000000
#define mod 1000000007
#define maxn 100000

using namespace std;

void solve(){
    string s, t, p;
    cin >> s >> t >> p;
    vector<char> pv;

    int j = 0;
    for (int i = 0; i < t.length(); i ++){
        if(j < s.length() && s[j] == t[i]){
            j ++;
        } else pv.pb(t[i]);
    }

    vector<int> a(26, 0);

    for(auto x : pv){
        a[x-'a'] ++;
    }
    cout << endl;

    for (auto x : p) a[x-'a']--;

    for(auto x : a) {
        if(x > 0) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

int main(int argc, char const *argv[])
{
    // freopen("standing.in", "r", stdin);
    // freopen("standing.out", "w", stdout);
    int t;
    cin >> t;
    while(t --){
        solve();
    }

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <ctime>
#include <sstream>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define N 20000000
#define mod 1000000007
#define maxn 100000

using namespace std;

int n, k;

void solve(){
    string s, t, p;
    cin >> s >> t >> p;
    vector<char> pv;

    int j = 0;
    for (int i = 0; i < t.length(); i ++){
        if(j < s.length() && s[j] == t[i]){
            j ++;
        } else pv.pb(t[i]);
    }

    // for (auto x : pv) cout << x;
    // cout << endl;

    vector<int> a(26, 0);

    for(auto x : pv){
        a[x-'a'] ++;
    }
    for (auto x : p) a[x-'a']--;
    for(auto x : a) if(x > 0) {
        cout << "NO" << endl;
        return;
    }
    cout << "YES" << endl;
}

int main(int argc, char const *argv[])
{
    // freopen("standing.in", "r", stdin);
    // freopen("standing.out", "w", stdout);
    int t;
    cin >> t;
    while(t --){
        solve();
    }

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <ctime>
#include <sstream>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define N 20000000
#define mod 1000000007
#define maxn 100000

using namespace std;

int n, k;

void solve(){
    string s, t, p;
    cin >> s >> t >> p;
    vector<char> pv;

    int j = 0;
    for (int i = 0; i < t.length(); i ++){
        if(j < s.length() && s[j] == t[i]){
            j ++;
        } else pv.pb(t[i]);
    }

    vector<int> a(26, 0);

    for(auto x : pv){
        a[x-'a'] ++;
    }

    for (auto x : p) a[x-'a']--;

    for(auto x : a) if(a[x-'a'] > 0) {
        cout << "NO" << endl;
        return;
    }
    cout << "YES" << endl;
}

int main(int argc, char const *argv[])
{
    // freopen("standing.in", "r", stdin);
    // freopen("standing.out", "w", stdout);
    int t;
    cin >> t;
    while(t --){
        solve();
    }

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <ctime>
#include <sstream>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define N 20000000
#define mod 1000000007
#define maxn 100000

using namespace std;

void solve(){
    string s, t, p;
    cin >> s >> t >> p;
    vector<int> a(26, 0);

    int j = 0;
    for (auto x : t){
        if(j < s.length() && s[j] == x){
            j ++;
        } else a[x - 'a'] ++;
    }
    if(j < s.length()){
        cout << "NO" << endl;
        return;
    }
    for (auto x : p) {
        a[x-'a']--;
    }

    for(auto x : a) {
        if(x > 0) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

int main(int argc, char const *argv[])
{
    // freopen("standing.in", "r", stdin);
    // freopen("standing.out", "w", stdout);
    int t;
    cin >> t;
    while(t --){
        solve();
    }

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <string>
#include <ctime>
#include <sstream>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define N 20000000
#define mod 1000000007
#define maxn 100000

using namespace std;

void solve(){
    string s, t, p;
    cin >> s >> t >> p;
    vector<int> a(26, 0);

    int j = 0;
    for (auto x : t){
        if(j < s.length() && s[j] == x){
            j ++;
        } else a[x - 'a'] ++;
    }

    for (auto x : p) {
        a[x-'a']--;
    }

    for(auto x : a) {
        if(x > 0) {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

int main(int argc, char const *argv[])
{
    // freopen("standing.in", "r", stdin);
    // freopen("standing.out", "w", stdout);
    int t;
    cin >> t;
    while(t --){
        solve();
    }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int T;
string a, b, c;
int kt[200];
int xh[200];

int main()
{
    cin >> T;

    while(T--)
    {
        cin >> a >> b >> c;
        memset(kt,0,sizeof(kt));
        for(int i = 0; i < b.length();i++)
            kt[b[i]] ++;
        for(int i = 0; i < a.length();i++)
            kt[a[i]] --;
            for(int i = 0; i < c.length();i++)
            kt[c[i]] --,xh[c[i]]++;
            int ok = 0;
            for(int i = 0; i < b.length();i++)
            if(kt[b[i]] > 0){cout << "NO\n",ok = 1;break;}
            if(!ok)
            {
                int l = 0;
                int dem = b.length() - a.length();
                for(int i = 0; i < b.length();i++)
                if(b[i]!=a[l]){
                    if(xh[b[i]])xh[b[i]]--,dem--;
                    else {cout << "NO\n",ok = 1;break;}
                }
                else {
                    l++;
                }
                if(dem < 0){cout << "NO\n";break;}
                if(!ok)cout << "YES\n";
            }
    }
}


#include<bits/stdc++.h>

using namespace std;

int T;
string a, b, c;
int kt[200];
int xh[200];

int main()
{
    cin >> T;

    while(T--)
    {
        cin >> a >> b >> c;
        memset(kt,0,sizeof(kt));
        memset(xh,0,sizeof(xh));
        for(int i = 0; i < b.length();i++)
            kt[b[i]] ++;
        for(int i = 0; i < a.length();i++)
            kt[a[i]] --;
            for(int i = 0; i < c.length();i++)
            kt[c[i]] --,xh[c[i]]++;
            int ok = 0;
            for(int i = 0; i < b.length();i++)
            if(kt[b[i]] > 0){cout << "NO\n",ok = 1;break;}
            if(!ok)
            {
                int l = 0;
                int dem = b.length() - a.length();
                for(int i = 0; i < b.length();i++)
                if(b[i]!=a[l]||l > a.length()){
                    if(xh[b[i]])xh[b[i]]--,dem--;
                    else {cout << "NO\n",ok = 1;break;}
                }
                else {
                    l++;
                }
                if(dem < 0&&ok==0){cout << "NO\n";break;}
                if(!ok)cout << "YES\n";
            }
    }
}


#include<bits/stdc++.h>

using namespace std;

int T;
string a, b, c;
int kt[200];
int xh[200];

int main()
{
    cin >> T;

    while(T--)
    {
        cin >> a >> b >> c;
        memset(kt,0,sizeof(kt));
//        memset(xh,0,sizeof(xh));
        for(int i = 0; i < b.length();i++)
            kt[b[i]] ++;
        for(int i = 0; i < a.length();i++)
            kt[a[i]] --;
            for(int i = 0; i < c.length();i++)
            kt[c[i]] --;
            int ok = 0;
            for(int i = 0; i < b.length();i++)
            if(kt[b[i]] > 0){cout << "NO\n",ok = 1;break;}
            if(!ok)
            {
                int l = 0;
                for(int i = 0; i < b.length(); i++)
                    if(a[l] == b[i])l++;
                if(l >= a.length())cout << "YES\n";
                else cout << "NO\n";
            }
    }
}


#include<bits/stdc++.h>

using namespace std;

int T;
string a, b, c;
int kt[200];
int xh[200];

int main()
{
    cin >> T;

    while(T--)
    {
        cin >> a >> b >> c;
        memset(kt,0,sizeof(kt));
        for(int i = 0; i < b.length();i++)
            kt[b[i]] ++;
        for(int i = 0; i < a.length();i++)
            kt[a[i]] --;
            for(int i = 0; i < c.length();i++)
            kt[c[i]] --,xh[c[i]]++;
            int ok = 0;
            for(int i = 0; i < b.length();i++)
            if(kt[b[i]] > 0){cout << "NO\n",ok = 1;break;}
            if(!ok)
            {
                int l = 0;
                int dem = b.length() - a.length();
                for(int i = 0; i < b.length();i++)
                if(b[i]!=a[l]){
                    if(xh[b[i]])xh[b[i]]--,dem--;
                    else {cout << "NO\n",ok = 1;break;}
                }
                else {
                    l++;
                }
                if(dem < 0&&ok==0){cout << "NO\n";break;}
                if(!ok)cout << "YES\n";
            }
    }
}


#include<bits/stdc++.h>

using namespace std;

int T;
string a, b, c;
int kt[200];

int main()
{
    cin >> T;

    while(T--)
    {
        cin >> a >> b >> c;
        memset(kt,0,sizeof(kt));
        for(int i = 0; i < b.length();i++)
            kt[b[i]] ++;
        for(int i = 0; i < a.length();i++)
            kt[a[i]] --;
            for(int i = 0; i < c.length();i++)
            kt[c[i]] --;
            int ok = 0;
            for(int i = 0; i < b.length();i++)
            if(kt[b[i]] > 0){cout << "NO\n",ok = 1;break;}
            if(!ok)cout << "YES\n";
    }
}


#include<bits/stdc++.h>

using namespace std;

int T;
string a, b, c;
int kt[200];
int xh[200];

int main()
{
    cin >> T;

    while(T--)
    {
        cin >> a >> b >> c;
        memset(kt,0,sizeof(kt));
        for(int i = 0; i < b.length();i++)
            kt[b[i]] ++;
        for(int i = 0; i < a.length();i++)
            kt[a[i]] --;
            for(int i = 0; i < c.length();i++)
            kt[c[i]] --,xh[c[i]]++;
            int ok = 0;
            for(int i = 0; i < b.length();i++)
            if(kt[b[i]] > 0){cout << "NO\n",ok = 1;break;}
            if(!ok)
            {
                int l = 0;
                int dem = b.length() - a.length();
                for(int i = 0; i < b.length();i++)
                if(b[i]!=a[l]||l >= a.length()){
                    if(xh[b[i]])xh[b[i]]--,dem--;
                    else {cout << "NO\n",ok = 1;break;}
                }
                else {
                    l++;
                }
                if(dem < 0&&ok==0){cout << "NO\n";break;}
                if(!ok)cout << "YES\n";
            }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    for (int iii = 0; iii < t; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[100] = {};

        for (int i = 0; i < tLen || index < sLen; i++)
            if (t[i] == s[index]) index++;
            else appear[t[i] - 'a']++;

        if (index != sLen){
            cout << "NO\n"; continue;
        }

        for (int i = 0; i < pLen; i++)
            appear[p[i] - 'a']--;
        bool ok = true;
        for (int i = 0; i < 26; i++)
            if (appear[i] > 0){
                ok = 0; break;
            }

        if (ok) cout << "YES\n"; else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    for (int iii = 0; iii < t; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[100] = {};

        for (int i = 0; i < tLen || index < sLen; i++)
            if (t[i] == s[index]) index++;
            else appear[t[i] - 'a']++;
        // for (int i = 0; i < 26; i++)
        //     cout << appear[i];
        // cout << endl;

        if (index != sLen){
            cout << "No\n"; continue;
        }

        for (int i = 0; i < pLen; i++)
            appear[p[i] - 'a']--;
        bool ok = true;
        for (int i = 0; i < 100; i++)
            if (appear[i] > 0){
                ok = false; break;
            }

        if (ok) cout << "YeS\n"; else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); //cin.tie(0); cout.tie(0);
    int q; cin >> q;
    for (int iii = 0; iii < q; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[26] = {};

        for (int i = 0; i < tLen; i++){
            if (index == sLen || t[i] != s[index]) appear[t[i] - 'a']++;
            else index++;
        }
        // for (int i = 0; i < 26; i++)
        //     cout << appear[i];
        // cout << endl;

        if (index != sLen){
            cout << "NO\n"; continue;
        }
        // cout << "////////" << index << '\n';
        for (int i = 0; i < pLen; i++)
            appear[p[i] - 'a']--;
        bool ok = true;
        for (int i = 0; i < 26; i++)
            if (appear[i] > 0){
                ok = false; break;
            }

        // for (int i = 0; i < 26; i++)
        //     cout << appear[i] << ' ';
        // cout << endl;
        if (ok) cout << "YES\n"; else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    for (int iii = 0; iii < t; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[26] = {};

        for (int i = 0; i < tLen || index < sLen; i++)
            if (t[i] == s[index]) index++;
            else appear[t[i] - 'a']++;

        if (index != sLen){
            cout << "NO\n"; continue;
        }

        for (int i = 0; i < pLen; i++)
            appear[p[i] - 'a']--;
        bool ok = true;
        for (int i = 0; i < 26; i++)
            if (appear[i] > 0){
                ok = 0; break;
            }

        if (ok) cout << "YES\n"; else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q; cin >> q;
    for (int iii = 0; iii < q; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[26] = {};

        for (int i = 0; i < tLen || index < sLen; i++)
            if (t[i] == s[index]) index++;
            else appear[t[i] - 'a']++;

        if (index != sLen){
            cout << "NO\n"; continue;
        }

        for (int i = 0; i < pLen; i++)
            appear[p[i] - 'a']--;
        bool ok = true;
        for (int i = 0; i < 26; i++)
            if (appear[i] > 0){
                ok = 0; break;
            }

        if (ok) cout << "YES\n"; else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    for (int iii = 0; iii < t; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[256] = {};

        for (int i = 0; i < tLen || index < sLen; i++)
            if (t[i] == s[index]) index++;
            else appear[t[i]]++;
        // for (int i = 0; i < 26; i++)
        //     cout << appear[i];
        // cout << endl;

        if (index != sLen){
            cout << "No\n"; continue;
        }

        for (int i = 0; i < pLen; i++)
            appear[p[i]]--;
        bool ok = true;
        for (int i = 0; i < 256; i++)
            if (appear[i] > 0){
                ok = false; break;
            }

        if (ok) cout << "YeS\n"; else cout << "NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q; cin >> q;
    for (int iii = 0; iii < q; iii++)
    {
        string s, t, p; cin >> s >> t >> p;
        int index = 0, tLen = t.length(), sLen = s.length(), pLen = p.length();
        int appear[256] = {};

        for (int i = 0; i < tLen || index < sLen; i++)
            if (t[i] == s[index]) index++;
            else appear[t[i]]++;
        // for (int i = 0; i < 26; i++)
        //     cout << appear[i];
        // cout << endl;

        if (index != sLen){
            cout << "NO\n"; continue;
        }

        for (int i = 0; i < pLen; i++)
            appear[p[i]]--;
        bool ok = true;
        for (int i = 0; i < 256; i++)
            if (appear[i] > 0){
                ok = false; break;
            }

        // for (int i = 0; i < 26; i++)
        //     cout << appear[i + 'a'];
        // cout << endl;
        if (ok) cout << "YES\n"; else cout << "NO\n";
    }

    return 0;
}


// DONT try this at home or school or any where else ..
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define repp(i,n) for(long long int i=1;i<=n;i++)
#define R return
#define B break
#define C continue
#define S second
#define F first
#define ll long long int
#define pa pair<long long int,long long int>
#define SI size()
#define pb push_back
using namespace std;
ll dif (ll a,ll b)
{
    R ((a/b)+(a%b!=0));
}

ll sol[26],h1[26],h2[26],h3[26];
ll p1[26],p2[26];

int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

ll t;
cin>>t;
while(t--)
{
string s,t,p;
cin>>s>>t>>p;
ll n1,n2,n3;
n1=s.SI;
n2=t.SI;
n3=p.SI;

bool f=0;

rep(i,min(n1,n2))
{
    p1[s[i]-'a']++;
    p2[t[i]-'a']++;
    if (p2[t[i]-'a']>p1[t[i]-'a'])
        f=1;
}

rep(i,26)
{
   p1[i]=p2[i],h1[i]=h2[i]=h3[i]=sol[i]=0;
}

if (f)
{
    cout <<"NO"<<endl;
    C;
}

rep(i,n1)
{
    h1[s[i]-'a']++;
}
rep(i,n2)
{
    h2[t[i]-'a']++;

}
rep(i,n3)
{
    h3[p[i]-'a']++;
}

rep(i,26)
{
    sol[i]=h2[i]-h1[i];
}

if (f)
    C;

rep(i,26)
{
    if (sol[i]<0||sol[i]>h3[i])
    {cout <<"NO"<<endl;
    f=1;
    B;
    }
}
if (!f)
    cout <<"YES"<<endl;

}
return 0;
}


// DONT try this at home or school or any where else ..
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define repp(i,n) for(long long int i=1;i<=n;i++)
#define R return
#define B break
#define C continue
#define S second
#define F first
#define ll long long int
#define pa pair<long long int,long long int>
#define SI size()
#define pb push_back
using namespace std;
ll dif (ll a,ll b)
{
    R ((a/b)+(a%b!=0));
}

ll sol[26],h1[26],h2[26],h3[26];

int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

ll t;
cin>>t;
while(t--)
{
string s,t,p;
cin>>s>>t>>p;
ll n1,n2,n3;
n1=s.SI;
n2=t.SI;
n3=p.SI;

bool f=0;

rep(i,26)
sol[i]=0;

rep(i,n3)
sol[p[i]-'a']++;

rep(i,max(0LL,n2-n1))
{
    s+='.';
}

rep(i,n2)
{
    if (t[i]!=s[i])
    {
        if (sol[t[i]-'a'])
        {
            string h;
            h+=t[i];
            s.insert(i,h);
            sol[t[i]-'a']--;
        }
        else
        {f=1;
            B;}
    }
}

if (f)
{
    cout<< "NO"<<endl;
    C;
}

rep(i,n2)
{
    if (t[i]!=s[i])
        f=1;
}

n1=s.SI;
ll ha=n1;
rep(i,n1)
{
    if (s[i]=='.')
        ha--;
}

if (f||ha!=n2)
    cout <<"NO"<<endl;
else
    cout <<"YES"<<endl;

}

return 0;
}


// DONT try this at home or school or any where else ..
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define repp(i,n) for(long long int i=1;i<=n;i++)
#define R return
#define B break
#define C continue
#define S second
#define F first
#define ll long long int
#define pa pair<long long int,long long int>
#define SI size()
#define pb push_back
using namespace std;
ll dif (ll a,ll b)
{
    R ((a/b)+(a%b!=0));
}

ll sol[26],h1[26],h2[26],h3[26];
ll p1[26],p2[26];

int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

ll t;
cin>>t;
while(t--)
{
string s,t,p;
cin>>s>>t>>p;
ll n1,n2,n3;
n1=s.SI;
n2=t.SI;
n3=p.SI;

bool f=0;

rep(i,26)
{
   p1[i]=p2[i],h1[i]=h2[i]=h3[i]=sol[i]=0;
}

if (f)
{
    cout <<"NO"<<endl;
    C;
}

rep(i,n1)
{
    h1[s[i]-'a']++;
}
rep(i,n2)
{
    h2[t[i]-'a']++;

}
rep(i,n3)
{
    h3[p[i]-'a']++;
}

rep(i,26)
{
    sol[i]=h2[i]-h1[i];
}

if (f)
    C;

rep(i,26)
{
    if (sol[i]<0||sol[i]>h3[i])
    {
    f=1;
    B;
    }
    else
        p1[i]=sol[i];
}

rep(i,min(n1,n2))
{
    p1[s[i]-'a']++;
    p2[t[i]-'a']++;
    if (p2[t[i]-'a']>p1[t[i]-'a'])
        f=1;
}

if (!f)
    cout <<"YES"<<endl;

    else
        cout <<"NO"<<endl;
}
return 0;
}


// DONT try this at home or school or any where else ..
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define repp(i,n) for(long long int i=1;i<=n;i++)
#define R return
#define B break
#define C continue
#define S second
#define F first
#define ll long long int
#define pa pair<long long int,long long int>
#define SI size()
#define pb push_back
using namespace std;
ll dif (ll a,ll b)
{
    R ((a/b)+(a%b!=0));
}

ll sol[26],h1[26],h2[26],h3[26];

int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

ll t;
cin>>t;
while(t--)
{
string s,t,p;
cin>>s>>t>>p;
ll n1,n2,n3;
n1=s.SI;
n2=t.SI;
n3=p.SI;

bool f=0;

rep(i,26)
sol[i]=0;

rep(i,n3)
sol[p[i]-'a']++;

rep(i,max(0LL,n2-n1))
{
    s+='.';
}

rep(i,n2)
{
    if (t[i]!=s[i])
    {
        if (sol[t[i]-'a'])
        {
            string h;
            h+=t[i];
            s.insert(i,h);
            sol[t[i]-'a']--;
        }
        else
        {f=1;
            B;}
    }
}

if (f)
{
    cout<< "NO"<<endl;
    C;
}

rep(i,n2)
{
    if (t[i]!=s[i])
        f=1;
}

if (f)
    cout <<"NO"<<endl;
else
    cout <<"YES"<<endl;

}

return 0;
}


// DONT try this at home or school or any where else ..
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define repp(i,n) for(long long int i=1;i<=n;i++)
#define R return
#define B break
#define C continue
#define S second
#define F first
#define ll long long int
#define pa pair<long long int,long long int>
#define SI size()
#define pb push_back
using namespace std;
ll dif (ll a,ll b)
{
    R ((a/b)+(a%b!=0));
}

ll sol[26],h1[26],h2[26],h3[26];
ll p1[26],p2[26];

int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

ll t;
cin>>t;
while(t--)
{
string s,t,p;
cin>>s>>t>>p;
ll n1,n2,n3;
n1=s.SI;
n2=t.SI;
n3=p.SI;

bool f=0;

rep(i,n3)
{
    p1[p[i]-'a']++;
}

rep(i,min(n1,n2))
{
    p1[s[i]-'a']++;
    p2[t[i]-'a']++;
    if (p2[t[i]-'a']>p1[t[i]-'a'])
        f=1;
}

rep(i,26)
{
   p1[i]=p2[i],h1[i]=h2[i]=h3[i]=sol[i]=0;
}

if (f)
{
    cout <<"NO"<<endl;
    C;
}

rep(i,n1)
{
    h1[s[i]-'a']++;
}
rep(i,n2)
{
    h2[t[i]-'a']++;

}
rep(i,n3)
{
    h3[p[i]-'a']++;
}

rep(i,26)
{
    sol[i]=h2[i]-h1[i];
}

if (f)
    C;

rep(i,26)
{
    if (sol[i]<0||sol[i]>h3[i])
    {cout <<"NO"<<endl;
    f=1;
    B;
    }
}
if (!f)
    cout <<"YES"<<endl;

}
return 0;
}


#include <iostream>
#include <cstring>
using namespace std;

#define MAXN 26
int order[MAXN],aim[MAXN];
int main()
{
    int q,i,j;
    int slen,tlen,plen,r;
    int ans;
    string s,t,p;
    cin>>q;
    while(q--)
    {
        cin>>s>>t>>p;
        slen=s.length();
        tlen=t.length();
        plen=p.length();
        //memset(order,0,sizeof(int));
       // memset(aim,0,sizeof(int));
       for(i=0;i<MAXN;i++)
       {
           order[i]=0;
           aim[i]=0;
       }
        for(i=0;i<tlen;i++)
        {
            aim[t[i]-'a']++;
        }
        for(i=0;i<slen;i++)
        {
            //order[s[i]-'a']++;
        }
        for(i=0;i<plen;i++)
        {
            order[p[i]-'a']++;
        }
        ans=0;
        if(slen>tlen)
            ans=1;
        else
        {
            int k=0;
            for(i=0;i<slen;i++)
            {
                while(s[i]!=t[k]&&k<tlen)
                {
                    k++;
                    //aim[s[i]-'a']--;
                }
                if(s[i]==t[k])
                    aim[s[i]-'a']--;
                if(k>=tlen)
                    break;
            }
            if(i<slen)
                ans=1;
        }
        for(i=0;i<MAXN;i++)
        {
            if(aim[i]>order[i])
            {
                ans=1;
            }
        }
        if(ans==1)
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;

    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
using namespace std;

char diff (char x, char y){
    for (int i=0; i<26; i++){
        if (x!=i+'a' and y!=i+'a'){
            return i+'a';
        }
    }
}

int main() {
	// your code goes here
	int n, t;
	cin>>n>>t;
	string s1, s2;
	cin>>s1>>s2;
	char res[n];

	int count= 0, curr= 0;
	int k1= 0, k2= 0;
	for (int i=0; i<n; i++){
		if (s1[i]!=s2[i]){
			if (k1>k2){
				res[i]= s2[i];
				k2++;
			}
			else{
				res[i]= s1[i];
				k1++;
			}
		}
		else{
			res[i]= diff(s1[i], s2[i]);
		}
	}

	if (k1!=k2){
		cout<<-1<<endl;
		return 0;
	}

	for (int i=0; i<n; i++){
		if (s1[i]!=res[i]) count++;
	}
	for (int i=0; i<n; i++){
		if (s1[i]==s2[i] and count>t){
			res[i]= s1[i];
			count--;
		}
	}
	vector <int> v;
	for (int i=0; i<n; i++){
		if (s1[i]!=s2[i]) v.push_back(i);
	}
	for (int i=0; i<v.size()/2; i++){
		if (count+2<=t){
			res[v[2*i]]= diff(s1[v[2*i]], s2[v[2*i]]);
			res[v[2*i+1]]= diff(s1[v[2*i+1]], s2[v[2*i+1]]);
			count+=2;
		}

	}

	for (int i=0; i<n; i++){
		if (s1[i]==s2[i] and count>t){
			res[i]= s1[i];
			count--;
		}
	}

	int qq= 0;
	for (int i=0; i<n; i++){
		if (res[i]!=s1[i]) qq++;
	}
	if (qq!=t) {
		cout<<-1<<endl;
		return 0;
	}
	for (int i=0; i<n; i++) cout<<res[i];

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(cnt < n - t) cout << "-1" << '\n';
    else{
        string c = a;
        for(int i = 0; i < n; ++i)
            if(a[i] != b[i]){
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(x == 'a') c[i] = 'c';
                    else if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        if(cnt == n - t) cout << c << '\n';
        else{
            cnt -= n - t;
            for(int i = 0; i < n; ++i){
                if(a[i] == b[i] && cnt > 0){
                    if(a[i] == 'z') c[i] = 'y';
                    else c[i] = a[i] + 1;
                    --cnt;
                }
            }
            cout << c << '\n';
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    if(cnt == t && n != cnt && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cnta < 0){
                ++cnta;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    int fa = 0, fb = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] != c[i]) ++fa;
        if(b[i] != c[i]) ++fb;
    }
    if(fa != fb && fa != t) cout << "-1" << '\n';
    else cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(n - t > cnt && n - cnt < 2 * (n - t)){
        cout << "-1" << '\n';
        return 0;
    }
    string c = a;
    int cnta = n, cntb = cnt;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cntb < n - t){
                c[i] = b[i];
                ++cntb;
                --cnta;
            }
            else if(cnta > n - t){
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else c[i] = x + y >> 1;
                --cnta;
            }
        }
    }
 //   if(cnta != cntb){
  //      cout << "-1" << '\n';
   //     return 0;
   // }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cnta > n - t){
                --cnta;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cnta < 0){
                ++cnta;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    int fa = 0, fb = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] != c[i]) ++fa;
        if(b[i] != c[i]) ++fb;
    }
    if(fa != fb || fa != t) cout << "-1" << '\n';
    else cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    if(cnt == t && n != cnt && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cnta < 0){
                ++cnta;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    int fa = 0, fb = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] != c[i]) ++fa;
        if(b[i] != c[i]) ++fb;
    }
    if(fa != fb || fa != t) cout << "-1" << '\n';
    else cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
            cout << "-1" << '\n';
            return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        }
    }
    cout << c << '\n';
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cntb < 0){
                ++cntb;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    cout << c << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
            cout << "-1" << '\n';
            return 0;
    }
    if(cnt == t && n != cnt && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cntb < 0){
                ++cntb;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
            cout << "-1" << '\n';
            return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cntb < 0){
                ++cntb;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    if(cnt == t && n != cnt && n - cnt > 2 * t){
        cout << "-1" << '\n';
        return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cntb < 0){
                ++cntb;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    int fa = 0, fb = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] != c[i]) ++fa;
        if(b[i] != c[i]) ++fb;
    }
    if(fa != fb && fa != t) cout << "-1" << '\n';
    else cout << c << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(cnt < n - t){
        if(t * 2 != n)
            cout << "-1" << '\n';
        else {
            string c = a;
            for(int i = 0; i < n / 2; ++i){
                c[i] = b[i];
            }
            cout << c << '\n';
        }
    }
    else{
        string c = a;
        for(int i = 0; i < n; ++i)
            if(a[i] != b[i]){
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        if(cnt == n - t) cout << c << '\n';
        else{
            cnt -= n - t;
            for(int i = 0; i < n; ++i){
                if(a[i] == b[i] && cnt > 0){
                    if(a[i] == 'z') c[i] = 'y';
                    else c[i] = a[i] + 1;
                    --cnt;
                }
            }
            cout << c << '\n';
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int main(){
    int n, t;
    cin >> n >> t;
    string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(int i = 0; i < n; ++i)
        if(a[i] == b[i]) ++cnt;
    if(t == 0){
        if(n == cnt) cout << a << '\n';
        else cout << "-1" << '\n';
        return 0;
    }
    if(cnt > t && n - cnt > 2 * t){
            cout << "-1" << '\n';
            return 0;
    }
    string c = a;
    int cnta = n - cnt - t, cntb = n - cnt - t;
    for(int i = 0; i < n; ++i){
        if(a[i] != b[i]){
            if(cnta > 0) --cnta;
            else if(cntb > 0) --cntb, c[i] = b[i];
            else{
                char x = a[i], y = b[i];
                if(x > y) swap(x, y);
                if(y - x == 1){
                    if(y == 'z') c[i] = 'x';
                    else c[i] = y + 1;
                }
                else {
                    c[i] = x + y >> 1;
                }
            }
        }
    }
    for(int i = 0; i < n; ++i){
        if(a[i] == b[i]){
            if(cnta < 0){
                ++cnta;
                if(a[i] == 'z') c[i] = 'x';
                else c[i] = a[i] + 1;
            }
        }
    }
    cout << c << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)

int main()

{
	ll n,i,j,k,t,diff=0,same=0;
	sl(n);sl(t);
	char a[n],b[n],c,p;
	scanf("%s %s",a,b);
	for1(i,n)
	{
		if(a[i]==b[i]) same++;
		else diff++;
	}
	if(t<diff)
	{
		printf("-1");
	}

	else
	{
		t=n-t;
		for1(i,n)
		{
			if(a[i]==b[i] && t>0)
			{
				printf("%c",a[i]);
				t--;
			}
			else
			{
				p='a';
				while(p==a[i] || p==b[i])
				p++;
				printf("%c",p);
			}

		}
	}
  return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)
int main(){
	const int N=1e5+10;
	char x[N],y[N],z[N];
bool st[N];
int len,t;
int same,odd;
		same=0;
		scanf("%d%d",&len,&t);
		scanf("%s%s",x,y);
		for(int i=0;i<len;i++){
				if(x[i]==y[i]) same++;
				st[i]=false;
		}
		int needsam=len-t;
		if(same<needsam){
				for(int i=0;i<len;i++)
				if(x[i]==y[i])
				{
				st[i]=true;
				z[i]=x[i];
				}
				needsam-=same;
				int l=len-same;
				if(l<2*needsam) puts("-1");
				else{
						int cnt=0;
						for(int i=0;i<len;i++){
								if(!st[i]){
										if(cnt<needsam) z[i]=x[i];
										else if(cnt<2*needsam) z[i]=y[i];
										else{
												z[i]='a';
												if(z[i]==x[i]||z[i]==y[i]) z[i]='b';
												if(z[i]==x[i]||z[i]==y[i]) z[i]='c';
										}
										cnt++;
								}
						}
						z[len]='\0';
						printf("%s\n",z);
				}
		}
		else{
				int cnt=0;
				for(int i=0;i<len;i++) {
						if(x[i]==y[i]&&cnt<needsam) {
							z[i]=y[i];
							cnt++;
							st[i]=true;
						}
				}
				for(int i=0;i<len;i++){
						if(!st[i]){
								z[i]='a';
								if(z[i]==x[i]||z[i]==y[i]) z[i]='b';
								if(z[i]==x[i]||z[i]==y[i]) z[i]='c';
						}
				}
				z[len]='\0';
				printf("%s\n",z);
		}

}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)

int main()

{
	ll n,i,j,k,t,diff=0,same=0,f1=0,f2=0;
	sl(n);sl(t);
	char a[n],b[n],c,p;
	scanf("%s %s",a,b);
	for1(i,n)
	{
		if(a[i]==b[i]) same++;
		else diff++;
	}
	if(n%2==0)
	{
		k=abs(diff-same);
	}
	else
	k=abs(diff-same)+1;
	if((n==1 ))
	{
		if(t==0)
		{
			if(a[0]==b[0])
			printf("%c",a[0]);
			else printf("-1");

		}
		else if(t==1)
		{
				p='a';
				while(p==a[0] || p==b[0])
				p++;
				printf("%c",p);
		}

	}
	else if(t<k)
	{
		printf("-1");
	}

	else
	{

		t=n-t;

		for1(i,n)
		{
			if(a[i]==b[i] && t>0)
			{
				printf("%c",a[i]);
				t--;
			}
			else if(t>0)
			{

					if(f1==0 && f2==0)
					{
						f1=1;
						printf("%c",a[i]);
					}
					else if(f2==0 && f1==1)
					{
						f2=1;
						printf("%c",b[i]);
					}
					if(f1==1 && f2==1)
					{
						f1=0;f2=0;
						t--;
					}
			}
			else
			{

				p='a';
				while(p==a[i] || p==b[i])
				p++;
				printf("%c",p);
			}
		}

		}

  return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)

int main()

{
	ll n,i,j,k,t,diff=0,same=0,f1=0,f2=0;
	sl(n);sl(t);
	char a[n],b[n],c,p;
	scanf("%s %s",a,b);
	for1(i,n)
	{
		if(a[i]==b[i]) same++;
		else diff++;
	}
	if(t<abs(diff-same)+1)
	{
		printf("-1");
	}

	else
	{
		t=n-t;
		for1(i,n)
		{
			if(a[i]==b[i] && t>0)
			{
				printf("%c",a[i]);
				t--;
			}
			else if(t>0)
			{

					if(f1==0 && f2==0)
					{
						f1=1;
						printf("%c",a[i]);
					}
					else if(f2==0 && f1==1)
					{
						f2=1;
						printf("%c",b[i]);
					}
					if(f1==1 && f2==1)
					{
						f1=0;f2=0;
						t--;
					}
			}
			else
			{
				p='a';
				while(p==a[i] || p==b[i])
				p++;
				printf("%c",p);
			}
		}

		}

  return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)

int main()

{
	ll n,i,j,k,t,diff=0,same=0,f1=0,f2=0;
	sl(n);sl(t);
	char a[n],b[n],c,p;
	scanf("%s %s",a,b);
	for1(i,n)
	{
		if(a[i]==b[i]) same++;
		else diff++;
	}

	if(t<abs(diff-same)+1 && n==1 && t<0)
	{
		printf("-1");
	}

	else
	{
		t=n-t;
		for1(i,n)
		{
			if(a[i]==b[i] && t>0)
			{
				printf("%c",a[i]);
				t--;
			}
			else if(t>0)
			{

					if(f1==0 && f2==0)
					{
						f1=1;
						printf("%c",a[i]);
					}
					else if(f2==0 && f1==1)
					{
						f2=1;
						printf("%c",b[i]);
					}
					if(f1==1 && f2==1)
					{
						f1=0;f2=0;
						t--;
					}
			}
			else
			{
				p='a';
				while(p==a[i] || p==b[i])
				p++;
				printf("%c",p);
			}
		}

		}

  return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)

int main()

{
	ll n,i,j,k,t,diff=0,same=0,f1=0,f2=0;
	sl(n);sl(t);
	char a[n],b[n],c,p;
	scanf("%s %s",a,b);
	for1(i,n)
	{
		if(a[i]==b[i]) same++;
		else diff++;
	}
	if(n==1 && t==0 && a[0]!=b[0])
	{
		printf("-1");
	}
	else if(t<abs(diff-same)+1 && n==1 && t<0)
	{
		printf("-1");
	}

	else
	{
		t=n-t;
		for1(i,n)
		{
			if(a[i]==b[i] && t>0)
			{
				printf("%c",a[i]);
				t--;
			}
			else if(t>0)
			{

					if(f1==0 && f2==0)
					{
						f1=1;
						printf("%c",a[i]);
					}
					else if(f2==0 && f1==1)
					{
						f2=1;
						printf("%c",b[i]);
					}
					if(f1==1 && f2==1)
					{
						f1=0;f2=0;
						t--;
					}
			}
			else
			{
				p='a';
				while(p==a[i] || p==b[i])
				p++;
				printf("%c",p);
			}
		}

		}

  return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define for1(i,n) for(i=0;i<n;i++)
#define for2(i,n) for(i=n-1;i>=0;i--)
#define ll long long int
#define CLEAR(array, value) memset(array, value, sizeof(array));
#define si(a)     scanf("%d", &a)
#define sl(a)     scanf("%lld", &a)
#define sc(a)     scanf(" %c", &a)
#define ss(a)     scanf("%s", a)
#define pi(a)     printf("%d\n", a)
#define pl(a)     printf("%lld\n", a)
#define pn        printf("\n")

#define mod long(1e9+7)

int main()

{
	ll n,i,j,k,t,diff=0,same=0;
	sl(n);sl(t);
	char a[n],b[n],c,p;
	scanf("%s %s",a,b);
	for1(i,n)
	{
		if(a[i]==b[i]) same++;
		else diff++;
	}
	if(t<diff || (n-t)<same)
	{
		printf("-1");
	}

	else
	{
		t=n-t;
		for1(i,n)
		{
			if(a[i]==b[i] && t>0)
			{
				printf("%c",a[i]);
				t--;
			}
			else
			{
				p='a';
				while(p==a[i] || p==b[i])
				p++;
				printf("%c",p);
			}

		}
	}
  return 0;

}


//Pham Huu Canh
//C. Marina and Vasya
//Algorithm:
//Complexity:
//AC:

#include <iostream>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define max64 9223372036854775807LL
#define max32 2147483647
#define maxty 1001001001
#define max16 32767
#define EPS 1e-8
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define PQ priority_queue
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define timmax(x, y)    ((x) > (y) ? (x) : (y))
#define timmin(x, y)    ((x) < (y) ? (x) : (y))
#define fori(i, n)      for((i) = 0; (i) < (n); (i)++)
#define ford(i, n)      for((i) = (n-1); (i) >= 0; (i)--)
#define fore(i, v)      for(typeof(v.begin()) i = v.begin(); i != v.end(); i++)
#define repi(i, a, b)   for((i) = (a); (i) <= (b); (i)++)
#define repd(i, a, b)   for((i) = (a); (i) >= (b); (i)--)
#define all(tmpv)      tmpv.begin(), tmpv.end()

#define fii "c.inp"
#define foo "c.out"
#define MOD 1000000007
#define inf 1000111000111000111LL

using namespace std;

typedef pair<int, int> II;
typedef vector<int> VI;
#define nmax 100005

char s[nmax], t[nmax], res[nmax];

void input()
{
    int i, j, k, n, cnt;

    scanf("%d %d", &n, &k);
    scanf("%s %s", &s, &t);

    cnt = 0;
    fori(i, n)  if (s[i] != t[i])   cnt++;

    if (cnt > k)    printf("-1");
    else
    {
        k -= cnt;
        strcpy(res, s);

        if (cnt){
            fori(i, n)  if (s[i] != t[i])
            {
                repi(j, 'a', 'z')   if (j != s[i] && j != t[i])
                {
                    res[i] = j;
                    cnt--;
                    break;
                }
                if (cnt == 0)   break;
            }
        }

        if (k){
            fori(i, n)  if (s[i] == t[i])
            {
                repi(j, 'a', 'z')   if (j != s[i])
                {
                    res[i] = j;
                    k--;
                    break;
                }
                if (k == 0) break;
            }
        }

        if (k)  printf("-1");
        else    printf("%s", res);
    }
}

int main()
{
    #ifndef ONLINE_JUDGE
        freopen(fii,"r",stdin);
        freopen(foo,"w",stdout);
    #endif

    input();

    return 0;
}