You are given three strings $s$, $t$ and $p$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings.

During each operation you choose any character from $p$, erase it from $p$ and insert it into string $s$ (you may insert this character anywhere you want: in the beginning of $s$, in the end or between any two consecutive characters). 

For example, if $p$ is aba, and $s$ is de, then the following outcomes are possible (the character we erase from $p$ and insert into $s$ is highlighted):

  aba $\rightarrow$ ba, de $\rightarrow$ ade;  aba $\rightarrow$ ba, de $\rightarrow$ dae;  aba $\rightarrow$ ba, de $\rightarrow$ dea;  aba $\rightarrow$ aa, de $\rightarrow$ bde;  aba $\rightarrow$ aa, de $\rightarrow$ dbe;  aba $\rightarrow$ aa, de $\rightarrow$ deb;  aba $\rightarrow$ ab, de $\rightarrow$ ade;  aba $\rightarrow$ ab, de $\rightarrow$ dae;  aba $\rightarrow$ ab, de $\rightarrow$ dea; 

Your goal is to perform several (maybe zero) operations so that $s$ becomes equal to $t$. Please determine whether it is possible.

Note that you have to answer $q$ independent queries.


-----Input-----

The first line contains one integer $q$ ($1 \le q \le 100$) — the number of queries. Each query is represented by three consecutive lines.

The first line of each query contains the string $s$ ($1 \le |s| \le 100$) consisting of lowercase Latin letters.

The second line of each query contains the string $t$ ($1 \le |t| \le 100$) consisting of lowercase Latin letters.

The third line of each query contains the string $p$ ($1 \le |p| \le 100$) consisting of lowercase Latin letters.


-----Output-----

For each query print YES if it is possible to make $s$ equal to $t$, and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).


-----Example-----
Input
4
ab
acxb
cax
a
aaaa
aaabbcc
a
aaaa
aabbcc
ab
baaa
aaaaa

Output
YES
YES
NO
NO



-----Note-----

In the first test case there is the following sequence of operation:   $s = $ ab, $t = $ acxb, $p = $ cax;  $s = $ acb, $t = $ acxb, $p = $ ax;  $s = $ acxb, $t = $ acxb, $p = $ a. 

In the second test case there is the following sequence of operation:   $s = $ a, $t = $ aaaa, $p = $ aaabbcc;  $s = $ aa, $t = $ aaaa, $p = $ aabbcc;  $s = $ aaa, $t = $ aaaa, $p = $ abbcc;  $s = $ aaaa, $t = $ aaaa, $p = $ bbcc.

Difficulty: interview

Starter code:

Solutions:
import sys

q = int(sys.stdin.readline().strip())
for Q in range(0, q):
    s = sys.stdin.readline().strip()
    t = sys.stdin.readline().strip()
    p = sys.stdin.readline().strip()
    i = 0
    j = 0
    alpha = [0] * 26
    while i != len(s) and j != len(t):
        if s[i] == t[j]:
            i = i + 1
            j = j + 1
        else:
            k = ord(t[j]) - ord('a')
            j = j + 1
            alpha[k] = alpha[k] + 1
    if i != len(s):
        print("NO")
    else:
        while j < len(t):
            k = ord(t[j]) - ord('a')
            j = j + 1
            alpha[k] = alpha[k] + 1
        j = 0
        while j < len(p):
            k = ord(p[j]) - ord('a')
            j = j + 1
            alpha[k] = alpha[k] - 1
        if max(alpha) > 0:
            print("NO")
        else:
            print("YES")

a = int(input())
for i in range(a):
    s = input()
    t = input()
    p = input()
    d = dict()
    for x in p:
        d[x] = d.get(x, 0) + 1
    uk1 = 0
    uk = 0
    f = False
    while uk < len(t):
        if uk1 == len(s) and d.get(t[uk], 0) <= 0:
            print('NO')
            f = True
            break
        if uk1 == len(s):
            d[t[uk]] -= 1
            uk += 1
        elif s[uk1] == t[uk]:
            uk += 1
            uk1 += 1
        elif d.get(t[uk], 0) == 0:
            print('NO')
            f = True
            break
        else:
            d[t[uk]] -= 1
            uk += 1
    if not f and uk1 == len(s):
        print('YES')
    elif uk1 != len(s) and not f:
        print('NO')

from sys import stdin
c=int(stdin.readline().strip())
for cas in range(c):
    s=list(stdin.readline().strip())
    t=list(stdin.readline().strip())
    p=list(stdin.readline().strip())
    rem=0
    flag=False
    x=s[0]
    y=0
    for i in range(len(t)):
        if x==t[i]:
            y+=1
            if y==len(s):
                flag=True
                break
            x=s[y]
                
    for i in range(len(s)):
        if s[i] in t:
            t.remove(s[i])
            rem+=1
    for i in range(len(p)):
        if p[i] in t:
            t.remove(p[i])


    if len(t)==0 and rem==len(s) and flag:
        print("YES")
    else:
        print("NO")
        
        


import sys
from collections import Counter
Q = int(input())
def check(a, b):
    a = a[::-1]
    b = b[::-1]
    for i in b[::-1]:
        if a and i == a[-1]:
            a.pop()
    if a:
        return False
    else:
        return True
for _ in range(Q):
    s = [ord(s) for s in sys.stdin.readline().strip()]
    t = [ord(s) for s in sys.stdin.readline().strip()]
    p = [ord(s) for s in sys.stdin.readline().strip()]
    if not check(s, t):
        sys.stdout.write('NO\n')
    else:
        Cs = Counter(s)
        Ct = Counter(t)
        Cp = Counter(p)
        if all(Ct[k] - Cs[k] <= Cp[k] for k in Ct.keys()):
            sys.stdout.write('YES\n')
        else:
            sys.stdout.write('NO\n')

n=int(input())
for i in range(n):
    s=input()
    t=input()
    p=input()
    mas1=[0]*26
    flag=True
    for i in range(len(s)):
        mas1[ord(s[i])-97]+=1
    mas2=[0]*26
    x1=0
    for i in range(len(t)):
        if x1<len(s) and s[x1]==t[i]:
            x1+=1
        mas2[ord(t[i])-97]+=1
    if x1!=len(s):
        print("NO")
    else:
        mas3=[0]*26
        for i in range(len(p)):
             mas3[ord(p[i])-97]+=1
        for i in range(26):
            if mas3[i]+mas1[i]<mas2[i]:
                flag=False
        if flag==True:
            print("YES")
        else:
            print("NO")

q = int(input())
alth = "qwertyuiopasdfghjklzxcvbnm"
for i in range(q):
    s = input()
    t = input()
    p = input()
    s1 = [0] * 26
    p1 = [0] * 26
    t1 = [0] * 26

    for i in s:
        s1[alth.find(i)] += 1

    for i in p:
        p1[alth.find(i)] += 1

    for i in t:
        t1[alth.find(i)] += 1

    ans = 1
    for i in range(26):
        if s1[i] + p1[i] < t1[i]:
            ans = 0
            break
    if ans == 0:
        print("NO")
    else:
        n = len(s)
        m = len(t)
        i = 0
        j = 0
        while i < n and j < m:
            if t[j] == s[i]:
                i += 1
            j += 1
        if i != n:
            ans = 0
        
        if ans == 0:
            print("NO")
        else:
            print("YES")


from collections import Counter

def check(s, t, p):
    p = Counter(p)
    idx = 0
    for ch in t:
        if idx < len(s) and s[idx] == ch:
            idx += 1
        elif ch in p and p[ch] > 0:
            p[ch] -= 1
        else:
            return False
    return idx == len(s)

q = int(input())
for _ in range(q):
    s = input()
    t = input()
    p = input()
    if check(s, t, p):
        print("YES")
    else:
        print("NO")


# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
from sys import stdin, stdout
import collections
import math

def isSubSequence(str1,str2):
    m = len(str1)
    n = len(str2)
    j = 0    # Index of str1 
    i = 0    # Index of str2 
    while j<m and i<n: 
        if str1[j] == str2[i]:     
            j = j+1    
        i = i + 1
    return j==m
    

T = int(input())
 
#A,H,Q = [int(x) for x in stdin.readline().split()] 
for t in range(T):
    #N,M = [int(x) for x in stdin.readline().split()]
    s = input()
    t = input()
    p = input()
    
    freq_s = {}
    freq_t = {}
    freq_p = {}
    for i in range(26):
        freq_s[chr(97+i)] = 0
        freq_t[chr(97+i)] = 0
        freq_p[chr(97+i)] = 0
        
    for letter in s:
        freq_s[letter] += 1
    for letter in t:
        freq_t[letter] += 1
    for letter in p:
        freq_p[letter] += 1
    
    # check s is subsequence of t, if not, print no    
    sub = isSubSequence(s,t)
    if sub==0:
        print('NO')
    else:
        flag = 0
        for i in range(26):
            d = freq_t[chr(97+i)] - freq_s[chr(97+i)]
            if d>0:
                #print(chr(97+i))
                if freq_p[chr(97+i)]<d and flag==0:
                    print('NO')
                    flag = 1
                    
        if flag==0:
            print('YES')
    
    
    
 


from collections import defaultdict as dd, deque
q = int(input())

def solve():
    def f(x):
        C = dd(int)
        for a in x:
            C[a] += 1
        return C
    
    s = input()
    t = input()
    p = input()

    cs = f(s)
    ct = f(t)
    cp = f(p)

    needed = dd(int)
    for k in ct:
        needed[k] += ct[k]
    for k in cs:
        needed[k] -= cs[k]

    for k in needed:
        if needed[k] > cp[k] or needed[k] < 0:
            return False

    i = 0
    j = 0
    while j < len(t):
        if i < len(s) and s[i] == t[j]:
            i += 1
            j += 1
        else:
            if ct[t[j]] > 0:
                ct[t[j]] -= 1
            else:
                return False
            j += 1
    return i == len(s) and j == len(t)
    

for _ in range(q):
    if solve():
        print('YES')
    else:
        print('NO')


def subseq(a,b):
    n=len(a)
    m=len(b)
    i=0 
    j=0 
    c=0 
    while i<n and j<m :
        if a[i]==b[j]:
            i+=1 
            j+=1 
            c+=1 
        else:
            j+=1 
    return c==n 
for _ in range(int(input())):
    s=input()
    t=input() 
    p=input()
    from collections import Counter 
    c1=Counter(s)
    c2=Counter(t)
    c3=Counter(p)
    f=1 
    if not subseq(s,t):
        f=0 
    l=[chr(i) for i in range(97,123)]
    for x in l:
        if c1[x]>c2[x]:
            f=0 
            break  
        req=c2[x]-c1[x]
        if c3[x]<req:
            f=0 
            break 
    print('YES' if f else 'NO')

import sys
input = sys.stdin.readline
from collections import Counter

Q=int(input())
for testcases in range(Q):
    s=input().strip()
    t=input().strip()
    p=input().strip()

    L=len(s)
    ind=0

    for te in t:
        if te==s[ind]:
            ind+=1
        if ind==L:
            break

    if ind != L:
        print("NO")
        continue

    C=Counter(s)+Counter(p)
    CT=Counter(t)

    #print(s,p,t,C,CT)

    for ct in CT:
        if CT[ct]>C[ct]:
            print("NO")
            break
    else:
        print("YES")

    


from collections import Counter
for _ in range(int(input())):
    s=input()
    t=input()
    p=input()
    cp=dict(Counter(p))
    i=0
    j=0
    lt=len(t)
    arr=[0]*lt
    ls=len(s)
    while i<ls and j<lt:
        if s[i]==t[j]:
            arr[j]=t[j]
            i+=1
            j+=1
        else:
            j+=1
    if i!=ls:
        print("NO")
    else:
        flag=0
        for i in range(lt):
            if arr[i]==0:
                try:
                    cp[t[i]]-=1
                    if cp[t[i]]<0:
                        flag=1
                        break
                    arr[i]=t[i]
                except:
                    flag=1
                    break
        #print(arr,flag)
        print("YES" if flag==0 else "NO")


def ain():
    return list(map( int, input().split() ))



# for _ in range( int(input()) ):
# n = int(input())
# python3 g.py

for _ in range( int(input()) ):
    s = input()
    t = input()
    p = input()
    fl = False
    i = 0
    for x in s:
        while i<len(t) and t[i] != x:
            i+=1
        if i == len(t):
            fl = True
            break
        i+=1
    if fl:
        print('NO')
    else:
        for x in t:
            if s.count(x) + p.count(x) < t.count(x):
                #print( x , s.count(x), p.count(x) , t.count(x)  )
                print('NO')
                fl = True
                break
        if not fl:
            print('YES')



def gns():
    return list(map(int,input().split()))
t=int(input())


def one():
    s=input()
    t=input()
    p=input()
    j=0
    for c in s:
        while j<len(t) and t[j]!=c:
            j+=1
        if j==len(t):
            print('NO')
            return
        j+=1
    def get_num(x):
        ans=[0]*26
        for c in x:
            c=ord(c)-ord('a')
            ans[c]+=1
        return ans
    ss=get_num(s)
    tt=get_num(t)
    pp=get_num(p)
    for i in range(26):
        if ss[i]+pp[i]<tt[i]:
            print('NO')
            return
    print('YES')


for i in range(t):
    one()






import math
from collections import deque, defaultdict
from sys import stdin, stdout
#input = stdin.readline
# print = stdout.write
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
for _ in range(int(input())):
    s = input()
    t = input()
    p = input()
    cs = defaultdict(int)
    ct = defaultdict(int)
    cp = defaultdict(int)
    for i in s:
        cs[i]+=1
    for i in t:
        ct[i]+=1
    for i in p:
        cp[i]+=1
    flag = True
    for i in ct.keys():
        if ct[i] > cs[i]+cp[i]:
            flag = False
    if flag:
        i = 0
        j = 0
        while i < len(s) and j < len(t):
            if s[i] == t[j]:
                i+=1
            j+=1
        if i == len(s):
            print('YES')
        else:
            print('NO')
    else:
        print('NO')

q = int(input())
for query in range(q):
	s = input()
	t = input()
	p = input()
	#s ma byc rowne t
	pointer_s = 0
	pointer_t = 0
	no = 0
	miejsca = []
	while pointer_s < len(s):
		while True:
			if pointer_t >= len(t):
				no = 1
				break
			elif t[pointer_t] != s[pointer_s]:
				pointer_t += 1
			else:
				pointer_s += 1
				miejsca.append(pointer_t)
				pointer_t += 1
				break
		if no == 1:
			break
	if no == 0:
		literki = [0] * 400
		for i in range(len(t)):
			if i not in miejsca:
				literki[ord(t[i])] += 1
		for i in range(len(p)):
			literki[ord(p[i])] -= 1
		for i in range(400):
			if literki[i] > 0:
				no = 1
				break
	if no == 0:
		print("YES")
	else:
		print("NO")
		


import sys
from collections import defaultdict
input = lambda: sys.stdin.readline().strip()
print = lambda x: sys.stdout.write(f"{x}\n")

dp = 0

def LCS(str1, str2):
    XY=0
    nonlocal dp
    _max=-1
    len1,len2=len(str1),len(str2)
    dp=[[ 0 for x in range(len1+1) ] for x in range(len2+1)]
    for x in range(1,len2+1):
        for y in range(1,len1+1):
            if str2[x-1]==str1[y-1]:
                dp[x][y]=dp[x-1][y-1]+1
            else:
                dp[x][y]=max(dp[x-1][y],dp[x][y-1])
            if _max<dp[x][y]:
                _max=dp[x][y]
                XY=[x,y]
    return (_max,XY)

 
def LCSSTRING(str1,str2,XY,answer):
    nonlocal dp
    X,Y=XY[0],XY[1]
    if dp[X][Y]==0:
        return answer
    if str2[X-1]==str1[Y-1]:
        answer=str2[X-1]+answer
        XY[0]-=1
        XY[1]-=1
    else:
        if dp[X-1][Y]>dp[X][Y-1]:
            XY[0]-=1
        else:
            XY[1]-=1
    return LCSSTRING(str1,str2,XY,answer)


for t in range(int(input())):
  s, t, p = input(), input(), input()

  m, xy = LCS(s, t)
  lcs = LCSSTRING(s, t, xy, "")

  if lcs != s:
    print("NO")
    continue

  d1 = defaultdict(int)
  d2 = defaultdict(int)
  for i in t:
    d1[i] += 1
  for i in p:
    d2[i] += 1
  for i in lcs:
    d2[i] += 1 

  flag = True 
  for i in t:
    if d1[i] > d2[i]:
      flag = False 
      break 
  
  if flag:
    print("YES")
  else:
    print("NO")





import sys
from collections import defaultdict
input = lambda: sys.stdin.readline().strip()
print = lambda x: sys.stdout.write(f"{x}\n")
sys.setrecursionlimit(200000)

dp = 0

def LCS(str1, str2):
    XY=0
    nonlocal dp
    _max=-1
    len1,len2=len(str1),len(str2)
    dp=[[ 0 for x in range(len1+1) ] for x in range(len2+1)]
    for x in range(1,len2+1):
        for y in range(1,len1+1):
            if str2[x-1]==str1[y-1]:
                dp[x][y]=dp[x-1][y-1]+1
            else:
                dp[x][y]=max(dp[x-1][y],dp[x][y-1])
            if _max<dp[x][y]:
                _max=dp[x][y]
                XY=[x,y]
    return (_max,XY)

 
def LCSSTRING(str1,str2,XY,answer):
    nonlocal dp
    X,Y=XY[0],XY[1]
    if dp[X][Y]==0:
        return answer
    if str2[X-1]==str1[Y-1]:
        answer=str2[X-1]+answer
        XY[0]-=1
        XY[1]-=1
    else:
        if dp[X-1][Y]>dp[X][Y-1]:
            XY[0]-=1
        else:
            XY[1]-=1
    return LCSSTRING(str1,str2,XY,answer)


for t in range(int(input())):
  s, t, p = input(), input(), input()

  m, xy = LCS(s, t)
  lcs = LCSSTRING(s, t, xy, "")

  if lcs != s:
    print("NO")
    continue

  d1 = defaultdict(int)
  d2 = defaultdict(int)
  for i in t:
    d1[i] += 1
  for i in p:
    d2[i] += 1
  for i in lcs:
    d2[i] += 1 

  flag = True 
  for i in t:
    if d1[i] > d2[i]:
      flag = False 
      break 
  
  if flag:
    print("YES")
  else:
    print("NO")





import sys
import math
#input = sys.stdin.readline

q=int(input())

for x in range(q):
	s=input()
	t=input()
	p=input()

	tc=[0]*26
	pc=[0]*26
	#print("yes")
	for i in range(len(p)):
	#	print(ord(p[i])-97)
		pc[ord(p[i])-97]+=1

	i=0
	j=0
	while i<len(s) and j<len(t):
		 if s[i]==t[j]:
		 	i+=1
		 	j+=1
		 else:
		 	j+=1

	if i==len(s):
		for y in range(len(t)):
			tc[ord(t[y])-97]+=1
		for y in range(len(s)):
			tc[ord(s[y])-97]-=1

		flag=True
		for y in range(26):
			if pc[y]<tc[y]:
				flag=False
				print("NO")
				break
		if flag:
			print("YES")

	else:
		print("NO")

q = int(input())
for _ in range(q):
    s = list(input())
    t = list(input())
    p = list(input())
    i = 0
    j = 0
    u = True
    while i < len(s):
        while j < len(t):
            if t[j] == s[i]:
                t[j] = ''
                j += 1
                break
            j += 1
        i += 1
    if t.count('') != len(s):
        print("NO")
        continue
    for i in p:
        for j in range(len(t)):
            if t[j] == i:
                t[j] = ''
                break
    t = ''.join(t)
    if t == '':
        print('YES')
    else:
        print('NO')


from collections import Counter

def isSubseq(s, x):
	i, j = 0, 0
	while True:
		if j == len(x):
			return True
		if i == len(s):
			return False
		if s[i] == x[j]:
			j += 1
		i += 1

for _ in range(int(input().strip())):
	s = input().strip()
	t = input().strip()
	p = input().strip()
	if not isSubseq(t, s):
		print('NO')
		continue
	cs, ct, cp = Counter(s), Counter(t), Counter(p)
	newc = {}
	for key in cs:
		newc[key] = cs[key]
	for key in cp:
		if key in list(newc.keys()):
			newc[key] += cp[key]
		else:
			newc[key] = cp[key]
	wrong = False
	for key in ct:
		if key in list(newc.keys()):
			if newc[key] < ct[key]:
				wrong = True
				break
		else:
			wrong = True
			break
	if wrong:
		print('NO')
	else:
		print('YES')