#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*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int T, i, f;
  char x[11], y[11];
  scanf("%d", &T);
  while (T--) {
    f = 0;
    scanf("%s", x);
    scanf("%s", y);
    for (i = 0; i < strlen(x); i++) {
      if (x[i] != '?' && y[i] != '?' && x[i] != y[i]) {
        f = 1;
        break;
      }
    }
    if (f)
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     123c <main+0x10c>
movl   $0x0,-0x10(%rbp)
lea    -0x1b(%rbp),%rsi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x26(%rbp),%rsi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    1210 <main+0xe0>
movslq -0xc(%rbp),%rax
movsbl -0x1b(%rbp,%rax,1),%eax
cmp    $0x3f,%eax
je     11fd <main+0xcd>
movslq -0xc(%rbp),%rax
movsbl -0x26(%rbp,%rax,1),%eax
cmp    $0x3f,%eax
je     11fd <main+0xcd>
movslq -0xc(%rbp),%rax
movsbl -0x1b(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x26(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11fd <main+0xcd>
movl   $0x1,-0x10(%rbp)
jmp    1210 <main+0xe0>
jmp    1202 <main+0xd2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <main+0x67>
cmpl   $0x0,-0x10(%rbp)
je     122b <main+0xfb>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
jmp    1237 <main+0x107>
lea    0xdd8(%rip),%rdi
call   1040 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1169 <main+0x39>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe93(%rip),%r14
lea    0x1d(%rsp),%rbx
lea    0x12(%rsp),%r15
lea    0xe85(%rip),%r12
lea    0xe82(%rip),%r13
jmp    119f <main+0x6f>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     1158 <main+0x28>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
test   %eax,%eax
jle    1193 <main+0x63>
xor    %ebp,%ebp
jmp    11e3 <main+0xb3>
nopl   0x0(%rax)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1190 <main+0x60>
movzbl 0x1d(%rsp,%rbp,1),%eax
cmp    $0x3f,%al
je     11d0 <main+0xa0>
movzbl 0x12(%rsp,%rbp,1),%ecx
cmp    $0x3f,%cl
je     11d0 <main+0xa0>
cmp    %cl,%al
je     11d0 <main+0xa0>
mov    %r13,%rdi
jmp    1193 <main+0x63>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"No\0A\00"
@.str.3 = [5 x i8] c"Yes\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [11 x i8]
%6 = alloca [11 x i8]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %60, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %61
12: ; preds = %8
store i32 0, i32* %4
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 0, i32* %3
br label %17
17: ; preds = %50, %12
%18 = load i32, i32* %3
%19 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %53
22: ; preds = %17
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 63
br i1 %28, label %29, label %49
29: ; preds = %22
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 63
br i1 %35, label %36, label %49
36: ; preds = %29
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %41, %46
br i1 %47, label %48, label %49
48: ; preds = %36
store i32 1, i32* %4
br label %53
49: ; preds = %36, %29, %22
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %17
53: ; preds = %48, %17
%54 = load i32, i32* %4
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %60
58: ; preds = %53
%59 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %58, %56
br label %8
61: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [4 x i8] c"Yes\00"
@str.4 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca [11 x i8]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%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 %38, label %11
11: ; preds = %0, %32
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%14 = call i32 @strlen(i8* %5)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %11, %27
%17 = phi i64 [ %28, %27 ], [ 0, %11 ]
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 63
br i1 %20, label %27, label %21
21: ; preds = %16
%22 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %17
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 63
%25 = icmp eq i8 %19, %23
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %27, label %32
27: ; preds = %16, %21
%28 = add nuw nsw i64 %17, 1
%29 = call i32 @strlen(i8* %5)
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %16, label %32
32: ; preds = %27, %21, %11
%33 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), %11 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0), %21 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), %27 ]
%34 = call i32 @puts(i8* dereferenceable(1) %33)
%35 = load i32, i32* %1
%36 = add nsw i32 %35, -1
store i32 %36, i32* %1
%37 = icmp eq i32 %35, 0
br i1 %37, label %38, label %11
38: ; preds = %32, %0
ret i32 0
}