#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 main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    char feedback[100000];
    scanf("%s", feedback);
    int i, d = 0;
    for (i = 2; feedback[i] != '\0'; ++i) {
      if ((feedback[i] == '0' && feedback[i - 1] == '1' &&
           feedback[i - 2] == '0') ||
          (feedback[i] == '1' && feedback[i - 1] == '0' &&
           feedback[i - 2] == '1')) {
        d = 1;
        break;
      }
    }
    if (d == 0)
      printf("Bad\n");
    else
      printf("Good\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1290 <main+0x170>
lea    -0x186b0(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x186b8(%rbp)
movl   $0x2,-0x186b4(%rbp)
movslq -0x186b4(%rbp),%rax
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1261 <main+0x141>
movslq -0x186b4(%rbp),%rax
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jne    11e9 <main+0xc9>
mov    -0x186b4(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x31,%eax
jne    11e9 <main+0xc9>
mov    -0x186b4(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
je     1239 <main+0x119>
movslq -0x186b4(%rbp),%rax
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x31,%eax
jne    1248 <main+0x128>
mov    -0x186b4(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jne    1248 <main+0x128>
mov    -0x186b4(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x186b0(%rbp,%rax,1),%eax
ff
cmp    $0x31,%eax
jne    1248 <main+0x128>
movl   $0x1,-0x186b8(%rbp)
jmp    1261 <main+0x141>
jmp    124d <main+0x12d>
mov    -0x186b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x186b4(%rbp)
jmp    1181 <main+0x61>
cmpl   $0x0,-0x186b8(%rbp)
jne    127f <main+0x15f>
lea    0xd91(%rip),%rdi
call   1030 <printf@plt>
jmp    128b <main+0x16b>
lea    0xd85(%rip),%rdi
call   1030 <printf@plt>
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186b0,%rsp
lea    0xec9(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    115d <main+0x3d>
xor    %eax,%eax
add    $0x186b0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0x12(%rsp),%r15
lea    0xe9a(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe96(%rip),%r12
lea    0xe8a(%rip),%r13
jmp    118f <main+0x6f>
xchg   %ax,%ax
mov    %r12,%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     114a <main+0x2a>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rax
jmp    11b8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %cl,%cl
je     1180 <main+0x60>
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x30,%cl
je     11e0 <main+0xc0>
cmp    $0x31,%cl
jne    11b0 <main+0x90>
cmpb   $0x30,-0x1(%rax)
jne    11b4 <main+0x94>
cmpb   $0x31,-0x2(%rax)
jne    11b4 <main+0x94>
jmp    11ec <main+0xcc>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0x31,-0x1(%rax)
jne    11b4 <main+0x94>
cmpb   $0x30,-0x2(%rax)
jne    11b4 <main+0x94>
mov    %r13,%rdi
jmp    1183 <main+0x63>

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

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