#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 *, char *);
int /*<<< orphan*/ scanf(char *, ...);
char *strpbrk(char *, char *);
int main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    char str1[100001];
    char str2[100001];
    char *p;
    scanf("%s ", str1);
    scanf("%s ", str2);
    p = strpbrk(str1, str2);
    printf("%s\n", (p == NULL) ? "NO" : "YES");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%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     11da <main+0xaa>
lea    -0x186b0(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x30d60(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x186b0(%rbp),%rdi
lea    -0x30d60(%rbp),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x30d68(%rbp)
mov    -0x30d68(%rbp),%rcx
lea    0xe54(%rip),%rsi
lea    0xe4a(%rip),%rax
cmp    $0x0,%rcx
cmove  %rax,%rsi
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x30d70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30d68,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11ce <main+0x9e>
lea    0xea1(%rip),%r14
lea    0x186c0(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe95(%rip),%r13
lea    0xe91(%rip),%rbp
lea    0xe83(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strpbrk@plt>
test   %rax,%rax
mov    %rbp,%rsi
cmove  %r13,%rsi
mov    %r12,%rdi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    1190 <main+0x60>
xor    %eax,%eax
add    $0x30d68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [3 x i8] c"NO\00"
@.str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100001 x i8]
%4 = alloca [100001 x 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)
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [100001 x i8], [100001 x i8]* %4, i64 0, i64 0
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [100001 x i8], [100001 x i8]* %4, i64 0, i64 0
%18 = call i8* @strpbrk(i8* %16, i8* %17)
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = icmp eq i8* %19, null
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %7
24: ; preds = %7
ret i32 0
}

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