description: You are given two strings s and t, both consisting of lowercase English letters. You are going to type the string s character by character, from the first character to the last one.
  
  When typing a character, instead of pressing the button corresponding to it, you can press the "Backspace" button. It deletes the last character you have typed among those that aren't deleted yet (or does nothing if there are no characters in the current string). For example, if s is "abcbd" and you press Backspace instead of typing the first and the fourth characters, you will get the string "bd" (the first press of Backspace deletes no character, and the second press deletes the character 'c'). Another example, if s is "abcaa" and you press Backspace instead of the last two letters, then the resulting text is "a".
  
  Your task is to determine whether you can obtain the string t, if you type the string s and press "Backspace" instead of typing several (maybe zero) characters of s.
  
  Input
  
  The first line contains a single integer q (1 ≤ q ≤ 10^5) — the number of test cases.
  
  The first line of each test case contains the string s (1 ≤ |s| ≤ 10^5). Each character of s is a lowercase English letter.
  
  The second line of each test case contains the string t (1 ≤ |t| ≤ 10^5). Each character of t is a lowercase English letter.
  
  It is guaranteed that the total number of characters in the strings over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case, print "YES" if you can obtain the string t by typing the string s and replacing some characters with presses of "Backspace" button, or "NO" if you cannot.
  
  You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).
  
  Example
  
  Input
  
  
  4
  ababa
  ba
  ababa
  bb
  aaa
  aaaa
  aababa
  ababa
  
  
  Output
  
  
  YES
  NO
  NO
  YES
  
  Note
  
  Consider the example test from the statement.
  
  In order to obtain "ba" from "ababa", you may press Backspace instead of typing the first and the fourth characters.
  
  There's no way to obtain "bb" while typing "ababa".
  
  There's no way to obtain "aaaa" while typing "aaa".
  
  In order to obtain "ababa" while typing "aababa", you have to press Backspace instead of typing the first character, then type all the remaining characters.
solution: import java.io.*;
  import java.util.*;
  import java.math.*;
  import java.math.BigInteger; 
  //import javafx.util.*; 
  public final class B
  {    
  	static PrintWriter out = new PrintWriter(System.out); 
  	static StringBuilder ans=new StringBuilder();
  	static FastReader in=new FastReader();
  	static ArrayList<Integer> g[];
  	static long mod=(long)1e9+7;
  	static int depth[],D[],par[];
  	static boolean set[];
  	static long INF=Long.MAX_VALUE;
  	static long dp[][];
  	static long min=10;
  	static long seg[],cnt[],cnta[],cntb[];
  	public static void main(String args[])throws IOException
  	{  					
  
  		int T=i();
  		outer:while(T-->0)
  		{
  			char X[]=in.next().toCharArray();
  			char Y[]=in.next().toCharArray();
  			int N=X.length,M=Y.length;	
  			if(M>N)ans.append("NO\n");
  			else if(N==M)
  			{
  				if(f(X,Y))ans.append("YES\n");
  				else ans.append("NO\n");
  			}
  			else
  			{
  				/*
  				 * 
  				 *
  				 * abcabcd
                     abcd
                     
                     */
  				int j=M-1; 
  				for(int i=N-1; i>=0; i--)
  				{
  //					System.out.println(i+" "+j);
  					if(j>=0 && X[i]==Y[j])
  					{
  						j--;
  					}
  					else if(j<0)
  					{
  						break;
  					}
  					else
  					{
  						//j++;
  						//if(j==M)j=M-1;
  						i--;
  					}
  					
  				}
  				if(j<0)ans.append("YES\n");
  				else ans.append("NO\n");
  			}
  		}
  		out.println(ans);
  		out.close();
  
  	}
  	static boolean f(char X[],char Y[])
  	{
  		for(int i=0; i<X.length; i++)if(X[i]!=Y[i])return false;
  		return true;
  	}
  	static void f()
  	{
  		
  	}
  	static boolean f(int i,int j,char X[],char Y[])
  	{
  		for(; i>=0 && j<Y.length; j++)
  		{
  			//			System.out.println(i+" "+j);
  			if(X[i]!=Y[j])return false;
  			i--;
  
  		}
  
  		if(j!=Y.length)return false;
  		return true;
  
  	}
  
  	
  
  	static boolean f(int j,long z,long A[],int N)
  	{
  		int i=0;
  		int x=j;
  		while(j<N)
  		{
  			if(i>=x)return false;
  			if(A[j]-A[i]<z)return false;
  			j++;
  			i++;
  		}
  		return true;
  	}
  
  
  	static boolean f(long x,long A[],int K,boolean f)
  	{
  		int N=A.length;
  		int c=0;
  		//		boolean f=true;
  		for(int i=0; i<N; i++) //odd pos gets less <=x 
  		{
  			if(f)
  			{
  				if(A[i]<=x)
  				{
  					c++;
  					f^=true;
  				}
  			}
  			else
  			{
  				f^=true;
  				c++;
  			}
  		}
  		return K<=c ;
  	}
  
  
  	static long[] hash(char X[],int pre[],char f[],long pow[])
  	{
  		long A[]=new long[X.length+1];
  		pow[0]=1L;
  		for(int i=0; i<X.length; i++)
  		{
  			char x=X[i];
  			A[i+1]=(A[i]+(x-'a'+1)*pow[i])%mod;
  			pow[i+1]=(pow[i]*27L)%mod;
  			if(f[x-'a']=='0')pre[i+1]++;
  			pre[i+1]+=pre[i];			
  		}
  		return A;
  	}
  
  	static long abs(long a,long b)
  	{
  		return Math.abs(a-b);
  	}
  
  
  	static int max(int a,int b,int c,int d)
  	{
  		return Math.max(Math.max(a,b),Math.max(c,d));
  	}
  	static long fact(long N)
  	{
  		long num=1L;
  		while(N>=1)
  		{
  			num=((num%mod)*(N%mod))%mod;
  			N--;
  		}
  		return num;
  	}
  	static boolean reverse(long A[],int l,int r)
  	{
  		while(l<r)
  		{
  			long t=A[l];
  			A[l]=A[r];
  			A[r]=t;
  			l++;
  			r--;
  		}
  		if(isSorted(A))return true;
  		else return false;
  	}
  	static boolean isSorted(long A[])
  	{
  		for(int i=1; i<A.length; i++)if(A[i]<A[i-1])return false;
  		return true;
  	}
  	static boolean isPalindrome(char X[],int l,int r)
  	{
  		while(l<r)
  		{
  			if(X[l]!=X[r])return false;
  			l++; r--;
  		}
  		return true;
  	}
  
  	static long min(long a,long b,long c)
  	{
  		return Math.min(a, Math.min(c, b));
  	}
  
  	static void print(int a)
  	{
  		System.out.println("! "+a);
  	}
  	static int find(int a)
  	{
  		if(par[a]<0)return a;
  		return par[a]=find(par[a]);
  	}
  	static void union(int a,int b)
  	{
  		a=find(a);
  		b=find(b);
  		if(a!=b)
  		{
  			par[a]+=par[b]; //transfers the size
  			par[b]=a;       //changes the parent
  		}
  	}
  	static void swap(char A[],int a,int b)
  	{
  		char ch=A[a];
  		A[a]=A[b];
  		A[b]=ch;
  	}
  
  	static void sort(long[] a) //check for long
  	{
  		ArrayList<Long> l=new ArrayList<>();
  		for (long i:a) l.add(i);
  		Collections.sort(l);
  		for (int i=0; i<a.length; i++) a[i]=l.get(i);
  	}
  	static void setGraph(int N)
  	{
  		//dp=new long[N+1][2][2];
  		D=new int[N+1];
  		par=new int[N+1];
  		depth=new int[N+1];
  		set=new boolean[N+1];
  		g=new ArrayList[N+1];
  		for(int i=0; i<=N; i++)
  		{
  			D[i]=N+1;
  			par[i]=-1;
  			g[i]=new ArrayList<Integer>();
  		}
  	}
  
  	static  long pow(long a,long b)
  	{
  		long pow=1;
  		long x=a;
  		while(b!=0)
  		{
  			if((b&1)!=0)pow=(pow*x)%mod;
  			x=(x*x)%mod;
  			b/=2;
  		}
  		return pow;
  	}
  	static long toggleBits(long x)//one's complement || Toggle bits
  	{
  		int n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;
  
  		return ((1<<n)-1)^x;
  	}
  	static int countBits(long a)
  	{
  		return (int)(Math.log(a)/Math.log(2)+1);
  	}
  	static void sort(int[] a) {
  		ArrayList<Integer> l=new ArrayList<>();
  		for (int i:a) l.add(i);
  		Collections.sort(l);
  		for (int i=0; i<a.length; i++) a[i]=l.get(i);
  	}
  	static boolean isPrime(long N)
  	{
  		if (N<=1)  return false; 
  		if (N<=3)  return true; 
  		if (N%2 == 0 || N%3 == 0) return false; 
  		for (int i=5; i*i<=N; i=i+6) 
  			if (N%i == 0 || N%(i+2) == 0) 
  				return false; 
  		return true; 
  	}
  	static long GCD(long a,long b) 
  	{
  		if(b==0)
  		{
  			return a;
  		}
  		else return GCD(b,a%b );
  	}
  
  	//Debugging Functions Starts
  
  	static void print(char A[])
  	{
  		for(char c:A)System.out.print(c+" ");
  		System.out.println();
  	}
  	static void print(boolean A[])
  	{
  		for(boolean c:A)System.out.print(c+" ");
  		System.out.println();
  	}
  	static void print(int A[])
  	{
  		for(int a:A)System.out.print(a+" ");
  		System.out.println();	
  	}
  	static void print(long A[])
  	{
  		for(long i:A)System.out.print(i+ " ");
  		System.out.println();
  
  	}
  	static void print(ArrayList<Integer> A)
  	{
  		for(int a:A)System.out.print(a+" ");
  		System.out.println();
  	}
  
  	//Debugging Functions END
  	//----------------------
  	//IO FUNCTIONS STARTS
  	static HashMap<Integer,Integer> Hash(int A[])
  	{
  		HashMap<Integer,Integer> mp=new HashMap<>();
  		for(int a:A)
  		{
  			int f=mp.getOrDefault(a,0)+1;
  			mp.put(a, f);
  		}
  		return mp;
  	}
  	static int i()
  	{
  		return in.nextInt();
  	}
  
  	static long l()
  	{
  		return in.nextLong();
  	}
  
  	static int[] input(int N){
  		int A[]=new int[N];
  		for(int i=0; i<N; i++)
  		{
  			A[i]=in.nextInt();
  		}
  		return A;
  	}
  
  	static long[] inputLong(int N)     {
  		long A[]=new long[N];
  		for(int i=0; i<A.length; i++)A[i]=in.nextLong();
  		return A;
  	}
  
  	//IO FUNCTIONS END
  
  }
  class pair implements Comparable<pair>
  {
  	int i; int a;
  	pair(int a,int i)
  	{
  		this.i=i;
  		this.a=a;
  	}
  	public int compareTo(pair X)
  	{
  		return X.a-this.a;
  	}
  
  }
  
  //Code For FastReader
  //Code For FastReader
  //Code For FastReader
  //Code For FastReader
  class FastReader
  {
  	BufferedReader br;
  	StringTokenizer st;
  	public FastReader()
  	{
  		br=new BufferedReader(new InputStreamReader(System.in));
  	}
  
  	String next()
  	{
  		while(st==null || !st.hasMoreElements())
  		{
  			try
  			{
  				st=new StringTokenizer(br.readLine());
  			}
  			catch(IOException e)
  			{
  				e.printStackTrace();
  			}
  		}
  		return st.nextToken();
  	}
  
  	int nextInt()
  	{
  		return Integer.parseInt(next());
  	}
  
  	long nextLong()
  	{
  		return Long.parseLong(next());
  	}
  	//gey
  	double nextDouble()
  	{
  		return Double.parseDouble(next());
  	}
  
  	String nextLine()
  	{
  		String str="";
  		try
  		{
  			str=br.readLine();
  		}
  		catch (IOException e)
  		{
  			e.printStackTrace();
  		}
  		return str;
  	}
  
  }