#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 getmax(int *, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int t, n, m, i;
  int a[100000];
  int v, l, r;
  int output;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; i++)
      scanf("%d", &a[i]);
    for (i = 0; i < m; i++) {
      scanf("%d%d%d", &v, &l, &r);
      output = getmax(a, v, l - 1, r - 1);
      if (output == 0)
        printf("No 0\n");
      else
        printf("Yes %d\n", output);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ab0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebb(%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     126b <main+0x13b>
lea    0xe93(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bf <main+0x8f>
movslq -0x14(%rbp),%rax
lea    -0x61aa0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x55>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1266 <main+0x136>
lea    0xe27(%rip),%rdi
lea    -0x61aa4(%rbp),%rsi
lea    -0x61aa8(%rbp),%rdx
lea    -0x61aac(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x61aa0(%rbp),%rdi
mov    -0x61aa4(%rbp),%esi
mov    -0x61aa8(%rbp),%edx
sub    $0x1,%edx
mov    -0x61aac(%rbp),%ecx
sub    $0x1,%ecx
call   1030 <getmax@plt>
mov    %eax,-0x61ab0(%rbp)
cmpl   $0x0,-0x61ab0(%rbp)
jne    123f <main+0x10f>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1253 <main+0x123>
mov    -0x61ab0(%rbp),%esi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1258 <main+0x128>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0x96>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x61ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61aa8,%rsp
lea    0xeac(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0x10(%rsp)
jae    117f <main+0x3f>
xor    %eax,%eax
add    $0x61aa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%r13
lea    0xe79(%rip),%r14
lea    0x18(%rsp),%r15
lea    0x14(%rsp),%r12
jmp    11a7 <main+0x67>
nopw   0x0(%rax,%rax,1)
subl   $0x1,0x10(%rsp)
jb     116b <main+0x2b>
lea    0xe54(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ef <main+0xaf>
mov    %r13,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     11d0 <main+0x90>
cmpl   $0x0,0x8(%rsp)
lea    0xe05(%rip),%rbp
jle    11a0 <main+0x60>
xor    %ebx,%ebx
jmp    122d <main+0xed>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xdf0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jge    11a0 <main+0x60>
mov    %rbp,%rdi
lea    0x1c(%rsp),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x1c(%rsp),%esi
mov    0x18(%rsp),%edx
add    $0xffffffff,%edx
mov    0x14(%rsp),%ecx
add    $0xffffffff,%ecx
mov    %r13,%rdi
call   1040 <getmax@plt>
test   %eax,%eax
jne    1210 <main+0xd0>
lea    0xda8(%rip),%rdi
call   1030 <puts@plt>
jmp    1220 <main+0xe0>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [7 x i8] c"%d%d%d\00"
@.str.4 = [8 x i8] c"Yes %d\0A\00"
@str = [5 x i8] c"No 0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100000 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %1 to i8*
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast [100000 x i32]* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = add nsw i32 %16, -1
store i32 %17, i32* %1
%18 = icmp eq i32 %16, 0
br i1 %18, label %58, label %19
19: ; preds = %0
%20 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 0
br label %25
21: ; preds = %54, %29
%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 %58, label %25
25: ; preds = %19, %21
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%27 = load i32, i32* %2
%28 = icmp sgt i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %32, %25
%30 = load i32, i32* %3
%31 = icmp sgt i32 %30, 0
br i1 %31, label %40, label %21
32: ; preds = %25, %32
%33 = phi i64 [ %36, %32 ], [ 0, %25 ]
%34 = getelementptr inbounds [100000 x i32], [100000 x i32]* %4, i64 0, i64 %33
%35 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %34)
%36 = add nuw nsw i64 %33, 1
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %36, %38
br i1 %39, label %32, label %29
40: ; preds = %29, %54
%41 = phi i32 [ %55, %54 ], [ 0, %29 ]
%42 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = add nsw i32 %44, -1
%46 = load i32, i32* %7
%47 = add nsw i32 %46, -1
%48 = call i32 @getmax(i32* %20, i32 %43, i32 %45, i32 %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %40
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %54
52: ; preds = %40
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %48)
br label %54
54: ; preds = %50, %52
%55 = add nuw nsw i32 %41, 1
%56 = load i32, i32* %3
%57 = icmp slt i32 %55, %56
br i1 %57, label %40, label %21
58: ; preds = %21, %0
ret i32 0
}