#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ isSubsequence(char *, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int T, isOk;
  char *s1, *s2;
  scanf("%d", &T);
  s1 = (char *)malloc(sizeof(char));
  s2 = (char *)malloc(sizeof(char));
  while (T--) {
    scanf("%s %s", s1, s2);
    isOk = (isSubsequence(s1, s2) || isSubsequence(s2, s1));
    if (isOk) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1214 <main+0xd4>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <isSubsequence@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
jne    11dd <main+0x9d>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <isSubsequence@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1203 <main+0xc3>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
jmp    120f <main+0xcf>
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <main+0x3d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeac(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x1,%edi
call   1040 <malloc@plt>
subl   $0x1,0xc(%rsp)
jae    118e <main+0x4e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %rax,%rbx
lea    0xe6b(%rip),%r15
lea    0xe6d(%rip),%r12
lea    0xe63(%rip),%r13
jmp    11bc <main+0x7c>
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     117e <main+0x3e>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <isSubsequence@plt>
mov    %r12,%rdi
test   %rax,%rax
jne    11b0 <main+0x70>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <isSubsequence@plt>
test   %rax,%rax
mov    %r12,%rdi
cmove  %r13,%rdi
jmp    11b0 <main+0x70>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%s %s\00"
@.str.2 = [5 x i8] c"YES\0A\00"
@.str.3 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i64 @malloc(i32 1)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %4
%9 = call i64 @malloc(i32 1)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %5
br label %11
11: ; preds = %37, %0
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %38
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %4
%20 = load i8*, i8** %5
%21 = call i64 @isSubsequence(i8* %19, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %15
%24 = load i8*, i8** %5
%25 = load i8*, i8** %4
%26 = call i64 @isSubsequence(i8* %24, i8* %25)
%27 = icmp ne i64 %26, 0
br label %28
28: ; preds = %23, %15
%29 = phi i1 [ true, %15 ], [ %27, %23 ]
%30 = zext i1 %29 to i32
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %37
35: ; preds = %28
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
br label %11
38: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%s %s\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i64 @malloc(i32 1)
%5 = inttoptr i64 %4 to i8*
%6 = call i64 @malloc(i32 1)
%7 = inttoptr i64 %6 to i8*
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %25, label %11
11: ; preds = %0, %19
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %7)
%13 = call i64 @isSubsequence(i8* %5, i8* %7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i64 @isSubsequence(i8* %7, i8* %5)
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0)
br label %19
19: ; preds = %15, %11
%20 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %11 ], [ %18, %15 ]
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = load i32, i32* %1
%23 = add nsw i32 %22, -1
store i32 %23, i32* %1
%24 = icmp eq i32 %22, 0
br i1 %24, label %25, label %11
25: ; preds = %19, %0
ret i32 0
}