#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 */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reverse(char *, char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int intCmd;
  scanf("%d", &intCmd);
  while (intCmd--) {
    char chStrA[101];
    char chStrB[101];
    char chStrBRev[101];
    scanf("%s %s", chStrA, chStrB);
    int iter, pointerB, pointerBRev;
    int strLenB = strlen(chStrB);
    reverse(chStrB, chStrBRev, strLenB);
    for (iter = 0, pointerB = 0, pointerBRev = 0; iter < strlen(chStrA);
         ++iter) {
      if (chStrA[iter] == chStrB[pointerB])
        ++pointerB;
      if (chStrA[iter] == chStrBRev[pointerBRev])
        ++pointerBRev;
    }
    if (pointerB == strLenB || pointerBRev == strLenB)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     12c2 <main+0x182>
lea    -0x70(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0xe0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x160(%rbp)
lea    -0xe0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
mov    -0x160(%rbp),%edx
call   1030 <reverse@plt>
movl   $0x0,-0x154(%rbp)
movl   $0x0,-0x158(%rbp)
movl   $0x0,-0x15c(%rbp)
mov    -0x154(%rbp),%eax
mov    %eax,-0x164(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x164(%rbp),%eax
cmp    %ecx,%eax
jge    127c <main+0x13c>
movslq -0x154(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x158(%rbp),%rcx
movsbl -0xe0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    1231 <main+0xf1>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
movslq -0x154(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x15c(%rbp),%rcx
movsbl -0x150(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    1263 <main+0x123>
mov    -0x15c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x15c(%rbp)
jmp    1268 <main+0x128>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    11da <main+0x9a>
mov    -0x158(%rbp),%eax
cmp    -0x160(%rbp),%eax
je     12a0 <main+0x160>
mov    -0x15c(%rbp),%eax
cmp    -0x160(%rbp),%eax
jne    12b1 <main+0x171>
lea    0xd62(%rip),%rdi
call   1050 <printf@plt>
jmp    12bd <main+0x17d>
lea    0xd56(%rip),%rdi
call   1050 <printf@plt>
jmp    1164 <main+0x24>
xor    %eax,%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    117f <main+0x3f>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xf0(%rsp),%rbx
lea    0x80(%rsp),%r15
jmp    11c8 <main+0x88>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %ebp,%r14d
lea    0xe5f(%rip),%rdi
lea    0xe5b(%rip),%rax
cmove  %rax,%rdi
cmp    %ebp,%r12d
cmove  %rax,%rdi
call   1040 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     116b <main+0x2b>
xor    %r12d,%r12d
lea    0xe31(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
mov    %eax,%edx
call   1030 <reverse@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x0,%r14d
test   %eax,%eax
jle    11a0 <main+0x60>
xor    %r13d,%r13d
xor    %r14d,%r14d
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0xf0(%rsp,%r13,1),%eax
mov    %r12d,%ecx
xor    %edx,%edx
cmp    0x80(%rsp,%rcx,1),%al
sete   %dl
add    %edx,%r12d
mov    %r14d,%ecx
xor    %edx,%edx
cmp    0x10(%rsp,%rcx,1),%al
sete   %dl
add    %edx,%r14d
add    $0x1,%r13
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%r13
jl     1220 <main+0xe0>
jmp    11a0 <main+0x60>

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 [101 x i8]
%4 = alloca [101 x i8]
%5 = alloca [101 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %76, %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 %77
15: ; preds = %11
%16 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%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 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %9
%21 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%22 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%23 = load i32, i32* %9
%24 = call i32 @reverse(i8* %21, i8* %22, i32 %23)
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %25
25: ; preds = %61, %15
%26 = load i32, i32* %6
%27 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %64
30: ; preds = %25
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %35, %40
br i1 %41, label %42, label %45
42: ; preds = %30
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %45
45: ; preds = %42, %30
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %50, %55
br i1 %56, label %57, label %60
57: ; preds = %45
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %60
60: ; preds = %57, %45
br label %61
61: ; preds = %60
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %25
64: ; preds = %25
%65 = load i32, i32* %7
%66 = load i32, i32* %9
%67 = icmp eq i32 %65, %66
br i1 %67, label %72, label %68
68: ; preds = %64
%69 = load i32, i32* %8
%70 = load i32, i32* %9
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %68, %64
%73 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %76
74: ; preds = %68
%75 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %76
76: ; preds = %74, %72
br label %11
77: ; 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 = alloca [101 x i8]
%3 = alloca [101 x i8]
%4 = alloca [101 x i8]
%5 = bitcast i32* %1 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, -1
store i32 %8, i32* %1
%9 = icmp eq i32 %7, 0
br i1 %9, label %53, label %10
10: ; preds = %0
%11 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
br label %14
14: ; preds = %10, %42
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %12)
%16 = call i32 @strlen(i8* %12)
%17 = call i32 @reverse(i8* %12, i8* %13, i32 %16)
%18 = call i32 @strlen(i8* %11)
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %42
20: ; preds = %14, %20
%21 = phi i64 [ %38, %20 ], [ 0, %14 ]
%22 = phi i32 [ %37, %20 ], [ 0, %14 ]
%23 = phi i32 [ %31, %20 ], [ 0, %14 ]
%24 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %21
%25 = load i8, i8* %24
%26 = zext i32 %23 to i64
%27 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %25, %28
%30 = zext i1 %29 to i32
%31 = add nuw nsw i32 %23, %30
%32 = zext i32 %22 to i64
%33 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %25, %34
%36 = zext i1 %35 to i32
%37 = add nuw nsw i32 %22, %36
%38 = add nuw nsw i64 %21, 1
%39 = call i32 @strlen(i8* %11)
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %20, label %42
42: ; preds = %20, %14
%43 = phi i32 [ 0, %14 ], [ %31, %20 ]
%44 = phi i32 [ 0, %14 ], [ %37, %20 ]
%45 = icmp eq i32 %43, %16
%46 = icmp eq i32 %44, %16
%47 = select i1 %45, i1 true, i1 %46
%48 = select i1 %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%49 = call i32 @puts(i8* dereferenceable(1) %48)
%50 = load i32, i32* %1
%51 = add nsw i32 %50, -1
store i32 %51, i32* %1
%52 = icmp eq i32 %50, 0
br i1 %52, label %53, label %14
53: ; preds = %42, %0
ret i32 0
}