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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x7e4(%rbp)
movl   $0x0,-0x7e8(%rbp)
movl   $0x0,-0x7ec(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x7e4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x7e4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x7e4(%rbp)
cmp    $0x0,%eax
je     12fb <main+0x1cb>
movl   $0x0,-0x7ec(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x7f8(%rbp)
lea    -0x7e0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x7f8(%rbp),%rax
cmp    %rcx,%rax
je     1206 <main+0xd6>
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
jmp    12f6 <main+0x1c6>
movl   $0x0,-0x7e8(%rbp)
movslq -0x7e8(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     12b5 <main+0x185>
movslq -0x7e8(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
movslq -0x7e8(%rbp),%rcx
movsbl -0x7e0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     127e <main+0x14e>
movslq -0x7e8(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x3f,%eax
je     127e <main+0x14e>
movslq -0x7e8(%rbp),%rax
movsbl -0x7e0(%rbp,%rax,1),%eax
ff
cmp    $0x3f,%eax
jne    128d <main+0x15d>
movl   $0x0,-0x7ec(%rbp)
jmp    129c <main+0x16c>
movl   $0x1,-0x7ec(%rbp)
jmp    12b5 <main+0x185>
jmp    12a1 <main+0x171>
mov    -0x7e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e8(%rbp)
jmp    1210 <main+0xe0>
cmpl   $0x0,-0x7ec(%rbp)
jne    12d3 <main+0x1a3>
lea    0xd41(%rip),%rdi
call   1040 <printf@plt>
jmp    12f1 <main+0x1c1>
cmpl   $0x1,-0x7ec(%rbp)
jne    12ec <main+0x1bc>
lea    0xd1f(%rip),%rdi
call   1040 <printf@plt>
jmp    12f1 <main+0x1c1>
jmp    12f6 <main+0x1c6>
jmp    1175 <main+0x45>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e8,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1177 <main+0x47>
xor    %eax,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe85(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x400(%rsp),%r12
lea    0xe78(%rip),%r13
lea    0xe6d(%rip),%rbp
jmp    11ac <main+0x7c>
mov    %rbp,%rdi
xchg   %ax,%ax
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     1163 <main+0x33>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %r13,%rdi
cmp    %rax,%rbx
jne    11a0 <main+0x70>
mov    0x10(%rsp),%al
mov    %rbp,%rdi
test   %al,%al
je     11a0 <main+0x70>
xor    %ecx,%ecx
jmp    11fd <main+0xcd>
movzbl 0x11(%rsp,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
je     119b <main+0x6b>
movzbl 0x400(%rsp,%rcx,1),%edx
cmp    $0x3f,%dl
je     11f0 <main+0xc0>
cmp    $0x3f,%al
je     11f0 <main+0xc0>
cmp    %dl,%al
je     11f0 <main+0xc0>
mov    %r13,%rdi
jmp    11a0 <main+0x70>

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