#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, ...);
int main() {
  char s[1000001];
  ;
  long c = 1, i, j, k, l, x, min, max, t;
  while (scanf("%s", s) == 1) {
    scanf("%ld", &t);
    printf("Case %ld:\n", c);
    for (i = 1; i <= t; i++) {
      j = 0;
      scanf("%ld %ld", &max, &min);
      if (min > max) {
        x = min;
        min = max;
        max = x;
      }
      k = 0;
      for (j = min; j < max; j++) {
        if ((s[j] ^ s[j + 1]) == 1) {
          k = 1;
          break;
        }
      }
      if (k == 0)
        printf("Yes\n");
      else
        printf("No\n");
    }
    getchar();
    c++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf42a0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0xf4258(%rbp)
lea    -0xf4250(%rbp),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1304 <main+0x1d4>
lea    0xea0(%rip),%rdi
lea    -0xf4298(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xf4258(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x1,-0xf4260(%rbp)
mov    -0xf4260(%rbp),%rax
cmp    -0xf4298(%rbp),%rax
jg     12e6 <main+0x1b6>
movq   $0x0,-0xf4268(%rbp)
lea    0xe48(%rip),%rdi
lea    -0xf4290(%rbp),%rsi
lea    -0xf4288(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xf4288(%rbp),%rax
cmp    -0xf4290(%rbp),%rax
jle    1219 <main+0xe9>
mov    -0xf4288(%rbp),%rax
mov    %rax,-0xf4280(%rbp)
mov    -0xf4290(%rbp),%rax
mov    %rax,-0xf4288(%rbp)
mov    -0xf4280(%rbp),%rax
mov    %rax,-0xf4290(%rbp)
movq   $0x0,-0xf4270(%rbp)
mov    -0xf4288(%rbp),%rax
mov    %rax,-0xf4268(%rbp)
mov    -0xf4268(%rbp),%rax
cmp    -0xf4290(%rbp),%rax
jge    129b <main+0x16b>
mov    -0xf4268(%rbp),%rax
movsbl -0xf4250(%rbp,%rax,1),%eax
ff
mov    -0xf4268(%rbp),%rcx
movsbl -0xf424f(%rbp,%rcx,1),%ecx
ff
xor    %ecx,%eax
cmp    $0x1,%eax
jne    127f <main+0x14f>
movq   $0x1,-0xf4270(%rbp)
jmp    129b <main+0x16b>
jmp    1284 <main+0x154>
mov    -0xf4268(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf4268(%rbp)
jmp    1232 <main+0x102>
cmpq   $0x0,-0xf4270(%rbp)
jne    12bc <main+0x18c>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ca <main+0x19a>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cf <main+0x19f>
mov    -0xf4260(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf4260(%rbp)
jmp    11a0 <main+0x70>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0xf4258(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf4258(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0xf42a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf4268,%rsp
lea    0xea8(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1270 <main+0x130>
mov    $0x1,%ebx
lea    0xe95(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x18(%rsp),%r12
lea    0xe8f(%rip),%r13
jmp    11b7 <main+0x77>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
add    $0x1,%rbx
lea    0xe5e(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1270 <main+0x130>
lea    0xe54(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe32(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x0,0x8(%rsp)
jle    1190 <main+0x50>
mov    $0x1,%ebp
jmp    1206 <main+0xc6>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <puts@plt>
lea    0x1(%rbp),%rax
cmp    0x8(%rsp),%rbp
mov    %rax,%rbp
jge    1190 <main+0x50>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rax
cmp    %rax,%rdx
jle    1240 <main+0x100>
mov    %rax,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rdx,%rcx
jmp    1250 <main+0x110>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rcx
mov    %rdx,%rax
cs nopw 0x0(%rax,%rax,1)
cmp    %rcx,%rax
jge    11f0 <main+0xb0>
movzbl 0x21(%rsp,%rax,1),%edx
xor    0x20(%rsp,%rax,1),%dl
add    $0x1,%rax
cmp    $0x1,%dl
jne    1250 <main+0x110>
lea    0xda8(%rip),%rdi
jmp    11f3 <main+0xb3>
xor    %eax,%eax
add    $0xf4268,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [11 x i8] c"Case %ld:\0A\00"
@.str.3 = [8 x i8] c"%ld %ld\00"
@str = [3 x i8] c"No\00"
@str.6 = [4 x i8] c"Yes\00"
define i32 @main() {
%1 = alloca [1000001 x i8]
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 0
%6 = bitcast i64* %2 to i8*
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %49
11: ; preds = %0, %44
%12 = phi i64 [ %46, %44 ], [ 1, %0 ]
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 %12)
%15 = load i64, i64* %4
%16 = icmp slt i64 %15, 1
br i1 %16, label %44, label %17
17: ; preds = %11, %38
%18 = phi i64 [ %41, %38 ], [ 1, %11 ]
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i64* %3, i64* %2)
%20 = load i64, i64* %2
%21 = load i64, i64* %3
%22 = icmp sgt i64 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i64 %21, i64* %2
store i64 %20, i64* %3
br label %24
24: ; preds = %23, %17
%25 = phi i64 [ %20, %23 ], [ %21, %17 ]
%26 = phi i64 [ %21, %23 ], [ %20, %17 ]
br label %27
27: ; preds = %30, %24
%28 = phi i64 [ %26, %24 ], [ %33, %30 ]
%29 = icmp slt i64 %28, %25
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 %28
%32 = load i8, i8* %31
%33 = add nsw i64 %28, 1
%34 = getelementptr inbounds [1000001 x i8], [1000001 x i8]* %1, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = xor i8 %35, %32
%37 = icmp eq i8 %36, 1
br i1 %37, label %38, label %27
38: ; preds = %30, %27
%39 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0), %27 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %30 ]
%40 = call i32 @puts(i8* dereferenceable(1) %39)
%41 = add nuw nsw i64 %18, 1
%42 = load i64, i64* %4
%43 = icmp slt i64 %18, %42
br i1 %43, label %17, label %44
44: ; preds = %38, %11
%45 = call i32 (...) @getchar()
%46 = add nuw nsw i64 %12, 1
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%48 = icmp eq i32 %47, 1
br i1 %48, label %11, label %49
49: ; preds = %44, %0
ret i32 0
}