#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 */
scalar_t__ abs(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int t;
  char s[10000];
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%s", s);
    int len_str = strlen(s);
    for (int j = 1; j < len_str; j++) {
      if (abs(s[j] - s[j - 1]) != abs(s[len_str - j] - s[len_str - j - 1])) {
        printf("Not Funny\n");
        j = len_str;
      }
      if (j == len_str - 1) {
        printf("Funny\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2740,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x2724(%rbp)
mov    -0x2724(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ae <main+0x16e>
lea    -0x2720(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x2720(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2728(%rbp)
movl   $0x1,-0x272c(%rbp)
mov    -0x272c(%rbp),%eax
cmp    -0x2728(%rbp),%eax
jge    1295 <main+0x155>
movslq -0x272c(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
mov    -0x272c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x2720(%rbp,%rcx,1),%ecx
ff
sub    %ecx,%eax
movsbl %al,%edi
call   1030 <abs@plt>
mov    %rax,-0x2738(%rbp)
mov    -0x2728(%rbp),%eax
sub    -0x272c(%rbp),%eax
cltq
movsbl -0x2720(%rbp,%rax,1),%eax
ff
mov    -0x2728(%rbp),%ecx
sub    -0x272c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x2720(%rbp,%rcx,1),%ecx
ff
sub    %ecx,%eax
movsbl %al,%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x2738(%rbp),%rax
cmp    %rcx,%rax
je     1259 <main+0x119>
lea    0xdbe(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2728(%rbp),%eax
mov    %eax,-0x272c(%rbp)
mov    -0x272c(%rbp),%eax
mov    -0x2728(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    127c <main+0x13c>
lea    0xd93(%rip),%rdi
call   1050 <printf@plt>
jmp    1281 <main+0x141>
mov    -0x272c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x272c(%rbp)
jmp    11ae <main+0x6e>
jmp    129a <main+0x15a>
mov    -0x2724(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2724(%rbp)
jmp    116e <main+0x2e>
xor    %eax,%eax
add    $0x2740,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2728,%rsp
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    122f <main+0xef>
xor    %eax,%eax
jmp    1191 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0xc(%rsp),%eax
add    $0x1,%eax
cmp    0x8(%rsp),%eax
jge    122f <main+0xef>
mov    %eax,0xc(%rsp)
lea    0xe67(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jl     1180 <main+0x40>
mov    %eax,%r12d
lea    -0x1(%r12),%r14d
mov    $0x1,%ebp
jmp    11e0 <main+0xa0>
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    %r15d,%ebp
add    $0x1,%ebp
cmp    %ebp,%r12d
jle    1180 <main+0x40>
movslq %ebp,%rbx
movzbl 0x10(%rsp,%rbx,1),%eax
sub    0xf(%rsp,%rbx,1),%al
movsbl %al,%edi
call   1040 <abs@plt>
mov    %rax,%r13
mov    %r12d,%eax
sub    %ebx,%eax
cltq
movzbl 0x10(%rsp,%rax,1),%ecx
sub    0xf(%rsp,%rax,1),%cl
movsbl %cl,%edi
call   1040 <abs@plt>
lea    0xdf0(%rip),%rdi
mov    %r12d,%r15d
cmp    %rax,%r13
jne    11d0 <main+0x90>
lea    0xde5(%rip),%rdi
mov    %r14d,%r15d
cmp    %r14d,%ebp
je     11d0 <main+0x90>
jmp    11d8 <main+0x98>
xor    %eax,%eax
add    $0x2728,%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 = [3 x i8] c"%s\00"
@.str.2 = [11 x i8] c"Not Funny\0A\00"
@.str.3 = [7 x i8] c"Funny\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10000 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %8
8: ; preds = %70, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %73
12: ; preds = %8
%13 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %5
store i32 1, i32* %6
br label %17
17: ; preds = %66, %12
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %69
21: ; preds = %17
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = sub nsw i32 %26, %32
%34 = trunc i32 %33 to i8
%35 = call i64 @abs(i8 signext %34)
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = sub nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = sub nsw i32 %43, %44
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = sub nsw i32 %42, %50
%52 = trunc i32 %51 to i8
%53 = call i64 @abs(i8 signext %52)
%54 = icmp ne i64 %35, %53
br i1 %54, label %55, label %58
55: ; preds = %21
%56 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%57 = load i32, i32* %5
store i32 %57, i32* %6
br label %58
58: ; preds = %55, %21
%59 = load i32, i32* %6
%60 = load i32, i32* %5
%61 = sub nsw i32 %60, 1
%62 = icmp eq i32 %59, %61
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %65
65: ; preds = %63, %58
br label %66
66: ; preds = %65
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %17
69: ; preds = %17
br label %70
70: ; preds = %69
%71 = load i32, i32* %4
%72 = add nsw i32 %71, 1
store i32 %72, i32* %4
br label %8
73: ; preds = %8
ret i32 0
}

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