Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause the corresponding symbol to appear more than once (if you press a key on a regular keyboard, it prints exactly one symbol).

For example, as a result of typing the word "hello", the following words could be printed: "hello", "hhhhello", "hheeeellllooo", but the following could not be printed: "hell", "helo", "hhllllooo".

Note, that when you press a key, the corresponding symbol must appear (possibly, more than once). The keyboard is broken in a random manner, it means that pressing the same key you can get the different number of letters in the result.

For each word in the letter, Methodius has guessed what word Polycarp actually wanted to write, but he is not sure about it, so he asks you to help him.

You are given a list of pairs of words. For each pair, determine if the second word could be printed by typing the first one on Polycarp's keyboard.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 10^5) — the number of pairs to check. Further input contains n descriptions of pairs.

The first line of each description contains a single non-empty word s consisting of lowercase Latin letters. The second line of the description contains a single non-empty word t consisting of lowercase Latin letters. The lengths of both strings are not greater than 10^6.

It is guaranteed that the total length of all words s in the input is not greater than 10^6. Also, it is guaranteed that the total length of all words t in the input is not greater than 10^6.

Output

Output n lines. In the i-th line for the i-th pair of words s and t print YES if the word t could be printed by typing the word s. Otherwise, print NO.

Examples

Input


4
hello
hello
hello
helloo
hello
hlllloo
hello
helo


Output


YES
YES
NO
NO


Input


5
aa
bb
codeforces
codeforce
polycarp
poolycarpp
aaaa
aaaab
abcdefghijklmnopqrstuvwxyz
zabcdefghijklmnopqrstuvwxyz


Output


NO
NO
YES
NO
NO
"""                         
Beautiful is better than ugly.
    Explicit is better than implicit.
Simple is better than complex.
    Complex is better than complicated.
Flat is better than nested.
    Sparse is better than dense.
                    
    * Readability counts *

 // Author : raj1307 - Raj Singh
 // Date   : 19.06.19

"""

from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def li(): return list(mi())

def dmain():
    sys.setrecursionlimit(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()
    
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading

abc='abcdefghijklmnopqrstuvwxyz'
d={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod,MOD=1000000007,998244353
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[0] 
def sort2(l):return sorted(l, key=getKey)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]

def powerMod(x,y,p):
    res = 1
    x %= p
    while y > 0:
        if y&1:
            res = (res*x)%p
        y = y>>1
        x = (x*x)%p1
    return res

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
    
def isPrime(n) : # Check Prime Number or not 
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
    return True


# For getting input from input.txt file 
#sys.stdin = open('input.txt', 'r')  
  
# Printing the Output to output.txt file 
#sys.stdout = open('output.txt', 'w') 

def main():
    
    
    
    for _ in range(ii()):
        
        fa=[0]*30
        fb=[0]*30
        a=list(si())
        b=list(si())
        
        if len(b)<len(a):
            print('NO')
            continue
        
        for i in a:
            fa[d[i]]+=1
        for i in b:
            fb[d[i]]+=1
        
        
        f=0
        
        for i in range(30):
            
            if fb[i]<fa[i]:
                print('NO')
                f=1
                break
            
            elif fa[i]!=0 and fb[i]==0:
                print('NO')
                f=1
                break
            
            elif fb[i]!=0 and fa[i]==0:
                print('NO')
                f=1
                break
     
       
        
        
        
        
        
        if f==1:
            continue
        
        m=[]
        j=0
        
        """flag=0
        for i in range(len(b)):
            
            if b[i]==a[j]:
                j+=1
                m.append(b[i])
                
                if j==len(a):
                    break
                flag=0
                
            elif flag==0:
                if i==0:
                    print('NO')
                    f=1
                    break
                else:
                    if b[i]!=a[j-1]:
                        print('NO')
                        f=1
                        break
                        
                flag=1"""
                
                
                
                
                
                
                
                
                
                
        f=[]
        af=[a[0]]
        cnt=1
        for i in range(1,len(a)):
            
            if a[i]!=a[i-1]:
                f.append(cnt)
                cnt=1
                af.append(a[i])
            else:
                cnt+=1
        
        
        
        f.append(cnt)
            
        ff=[]    
        aff=[b[0]]
        cnt=1
        for i in range(1,len(b)):
            
            if b[i]!=b[i-1]:
                ff.append(cnt)
                cnt=1
                aff.append(b[i])
            else:
                cnt+=1
        
        
        if af!=aff:
            print('NO')
            continue
        
        
        
        ff.append(cnt)
            
        flag=0  
        #print(f)
        #print(ff)
        if len(f)!=len(ff):
            print('NO')
            flag=1
        else:
            
            for i in range(len(f)):
                if ff[i]<f[i]:
                    print('NO')
                    flag=1
                    break
        
        
        if flag==0:
            print('YES')
        
        
            
                
        """        
                
            
        
        
        
        
        
        
        
        
        
        
        for i in range(len(a)):
            
            dic1[a[i]].append()
            
            
            
            
        
        
        
        f=[]
        cnt=1
        for i in range(1,len(a)):
            
            if a[i]!=a[i-1]:
                f.append(cnt)
                cnt=1
            else:
                cnt+=1
        
        if cnt!=1:
            f.append(cnt)
            
        ff=[]    
        cnt=1
        for i in range(1,len(b)):
            
            if b[i]!=b[i-1]:
                f.append(cnt)
                cnt=1
            else:
                cnt+=1
        
        if cnt!=1:
            f.append(cnt)
        
        
    
        f[0]-=1
        for i in range(1,len(b)):
            
            if b[i]!=b[i-1] or f[j]          #fb[d[b[i]]]!=fa[d[b[i]]]:
                x.append(b[i])
                fb[d[b[i]]]-=1
                
            if b[i]!=b[i-1]:    
                j+=1
                
        y=[a[0]]
        for i in range(1,len(a)):
            
            if a[i]!=a[i-1]:
                y.append(a[i])
        
                
        if a==x:
            print('YES')
            
        else:
            print(a,x)
            print('NO')
            
            
        
            
        
       if f==1:
            continue
        
        print(a,b)
        
        if set(a)==set(b):
            print('YES')
        else:
            print('NO')
    
    
    
    
    
    
    """
    
    
    
    
    
            
        
    
    
    
    
    
    
    
    
    
    




# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        if self.buffer.tell():
            return self.buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()
    #dmain()