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 static java.lang.Math.max;
  import static java.lang.Math.min;
  import static java.lang.Math.abs;
  import static java.lang.System.out;
  import java.util.*;
  import java.io.*;
  import java.math.*;
  
  public class Template {
  
  	static int mod = 1000000007;
  
  	public static void main(String[] args) {
  		FastScanner sc = new FastScanner();
          PrintWriter out = new PrintWriter(System.out);
  		int yo = sc.nextInt();
  		while (yo-- > 0) {
  			StringBuilder s = new StringBuilder(sc.next());
              StringBuilder t = new StringBuilder(sc.next());
              s = s.reverse();
              t = t.reverse();
              if(solve(s.toString(),t.toString(),s.length(),t.length())){
                  out.println("YES");
              }
              else {
                  out.println("NO");
              }
  		}
          out.close();
  	}
      
      static boolean solve(String s, String t, int S, int T){
          int k = -1;
          int j = 0;
          for(int i = 0; i < S && j < T; i++){
              if(s.charAt(i) == t.charAt(j) && ((i-k)%2 == 1)){
                  j++;
                  k = i;
              }
          }
          return j == T;
      }
  
  	public static class Pair {
  		int x;
  		int y;
  
  		public Pair(int x, int y) {
  			this.x = x;
  			this.y = y;
  		}
  	}
  
  	public static void sort(int[] arr) {
  		ArrayList<Integer> ls = new ArrayList<Integer>();
  		for (int x : arr)
  			ls.add(x);
  		Collections.sort(ls);
  		for (int i = 0; i < arr.length; i++)
  			arr[i] = ls.get(i);
  	}
  
  	public static long gcd(long a, long b) {
  		if (b == 0)
  			return a;
  		return gcd(b, a % b);
  	}
  
  	static boolean[] sieve(int N) {
  		boolean[] sieve = new boolean[N + 1];
  		for (int i = 2; i <= N; i++)
  			sieve[i] = true;
  
  		for (int i = 2; i <= N; i++) {
  			if (sieve[i]) {
  				for (int j = 2 * i; j <= N; j += i) {
  					sieve[j] = false;
  				}
  			}
  		}
  		return sieve;
  	}
  
  	public static long power(long x, long y, long p) {
  		long res = 1L;
  		x = x % p;
  		while (y > 0) {
  			if ((y & 1) == 1)
  				res = (res * x) % p;
  			y >>= 1;
  			x = (x * x) % p;
  		}
  		return res;
  	}
  
  	public static void print(int[] arr) {
  		//for debugging only
  		for (int x : arr)
  			out.print(x + " ");
  		out.println();
  	}
  
  	static class FastScanner {
  		private int BS = 1 << 16;
  		private char NC = (char) 0;
  		private byte[] buf = new byte[BS];
  		private int bId = 0, size = 0;
  		private char c = NC;
  		private double cnt = 1;
  		private BufferedInputStream in;
  
  		public FastScanner() {
  			in = new BufferedInputStream(System.in, BS);
  		}
  
  		public FastScanner(String s) {
  			try {
  				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
  			} catch (Exception e) {
  				in = new BufferedInputStream(System.in, BS);
  			}
  		}
  
  		private char getChar() {
  			while (bId == size) {
  				try {
  					size = in.read(buf);
  				} catch (Exception e) {
  					return NC;
  				}
  				if (size == -1)
  					return NC;
  				bId = 0;
  			}
  			return (char) buf[bId++];
  		}
  
  		public int nextInt() {
  			return (int) nextLong();
  		}
  
  		public int[] readInts(int N) {
  			int[] res = new int[N];
  			for (int i = 0; i < N; i++) {
  				res[i] = (int) nextLong();
  			}
  			return res;
  		}
  
  		public long[] readLongs(int N) {
  			long[] res = new long[N];
  			for (int i = 0; i < N; i++) {
  				res[i] = nextLong();
  			}
  			return res;
  		}
  
  		public long nextLong() {
  			cnt = 1;
  			boolean neg = false;
  			if (c == NC)
  				c = getChar();
  			for (; (c < '0' || c > '9'); c = getChar()) {
  				if (c == '-')
  					neg = true;
  			}
  			long res = 0;
  			for (; c >= '0' && c <= '9'; c = getChar()) {
  				res = (res << 3) + (res << 1) + c - '0';
  				cnt *= 10;
  			}
  			return neg ? -res : res;
  		}
  
  		public double nextDouble() {
  			double cur = nextLong();
  			return c != '.' ? cur : cur + nextLong() / cnt;
  		}
  
  		public double[] readDoubles(int N) {
  			double[] res = new double[N];
  			for (int i = 0; i < N; i++) {
  				res[i] = nextDouble();
  			}
  			return res;
  		}
  
  		public String next() {
  			StringBuilder res = new StringBuilder();
  			while (c <= 32)
  				c = getChar();
  			while (c > 32) {
  				res.append(c);
  				c = getChar();
  			}
  			return res.toString();
  		}
  
  		public String nextLine() {
  			StringBuilder res = new StringBuilder();
  			while (c <= 32)
  				c = getChar();
  			while (c != '\n') {
  				res.append(c);
  				c = getChar();
  			}
  			return res.toString();
  		}
  
  		public boolean hasNext() {
  			if (c > 32)
  				return true;
  			while (true) {
  				c = getChar();
  				if (c == NC)
  					return false;
  				else if (c > 32)
  					return true;
  			}
  		}
  	}
  
  	//	For Input.txt and Output.txt	
  	//	FileInputStream in = new FileInputStream("input.txt");
  	//	FileOutputStream out = new FileOutputStream("output.txt");
  	//	PrintWriter pw = new PrintWriter(out);
  	//	Scanner sc = new Scanner(in);
  }