#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 *, long long *);
int main(void) {
  long long int n, t;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    if (n % 6 == 0)
      printf("Misha\n");
    else
      printf("Chef\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     11a2 <main+0x82>
lea    0xea1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    $0x6,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1191 <main+0x71>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    119d <main+0x7d>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subq   $0x1,0x8(%rsp)
jae    1158 <main+0x38>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea1(%rip),%r14
lea    0x10(%rsp),%r15
movabs $0xaaaaaaaaaaaaaaab,%r12
aa aa aa
movabs $0x2aaaaaaaaaaaaaaa,%r13
aa aa 2a
movabs $0x2aaaaaaaaaaaaaab,%rbx
aa aa 2a
lea    0xe81(%rip),%rbp
jmp    119d <main+0x7d>
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
subq   $0x1,0x8(%rsp)
jb     1147 <main+0x27>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
imul   %r12,%rax
add    %r13,%rax
ror    %rax
mov    %rbp,%rdi
cmp    %rbx,%rax
jb     1190 <main+0x70>
lea    0xe3f(%rip),%rdi
jmp    1190 <main+0x70>

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [7 x i8] c"Misha\0A\00"
@.str.2 = [6 x i8] c"Chef\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %5
5: ; preds = %18, %0
%6 = load i64, i64* %3
%7 = add nsw i64 %6, -1
store i64 %7, i64* %3
%8 = icmp ne i64 %6, 0
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = srem i64 %11, 6
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %9
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %5
19: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@str = [5 x i8] c"Chef\00"
@str.3 = [6 x i8] c"Misha\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = add nsw i64 %6, -1
store i64 %7, i64* %2
%8 = icmp eq i64 %6, 0
br i1 %8, label %19, label %9
9: ; preds = %0, %9
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%11 = load i64, i64* %1
%12 = srem i64 %11, 6
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0)
%15 = call i32 @puts(i8* dereferenceable(1) %14)
%16 = load i64, i64* %2
%17 = add nsw i64 %16, -1
store i64 %17, i64* %2
%18 = icmp eq i64 %16, 0
br i1 %18, label %19, label %9
19: ; preds = %9, %0
ret i32 0
}