#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 a[10000];
  int i, j, l, flag;
  scanf("%d", &t);
  while (t--) {
    scanf("%s", a);
    l = strlen(a);
    i = 0;
    j = l - 1;
    flag = 1;
    while (i < l - 1) {
      if (abs(a[i] - a[i + 1]) == abs(a[j] - a[j - 1])) {
        i++;
        j--;
      } else {
        flag = 0;
        break;
      }
    }
    if (flag) {
      printf("Funny\n");
    } else {
      printf("Not 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>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     12b3 <main+0x173>
lea    -0x2720(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x2720(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x272c(%rbp)
movl   $0x0,-0x2724(%rbp)
mov    -0x272c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2728(%rbp)
movl   $0x1,-0x2730(%rbp)
mov    -0x2724(%rbp),%eax
mov    -0x272c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1284 <main+0x144>
movslq -0x2724(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
mov    -0x2724(%rbp),%ecx
add    $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)
movslq -0x2728(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
mov    -0x2728(%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
jne    1270 <main+0x130>
mov    -0x2724(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2724(%rbp)
mov    -0x2728(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2728(%rbp)
jmp    127f <main+0x13f>
movl   $0x0,-0x2730(%rbp)
jmp    1284 <main+0x144>
jmp    11c2 <main+0x82>
cmpl   $0x0,-0x2730(%rbp)
je     12a2 <main+0x162>
lea    0xd72(%rip),%rdi
call   1050 <printf@plt>
jmp    12ae <main+0x16e>
lea    0xd5d(%rip),%rdi
call   1050 <printf@plt>
jmp    1164 <main+0x24>
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    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    117f <main+0x3f>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%r15
jmp    11a3 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     116b <main+0x2b>
lea    0xe59(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
add    $0xffffffff,%eax
cltq
test   %eax,%eax
mov    $0x0,%ebp
cmovg  %eax,%ebp
neg    %rbp
lea    (%rsp,%rax,1),%r13
add    $0x10,%r13
lea    0x11(%rsp),%r12
xor    %r14d,%r14d
xchg   %ax,%ax
cmp    %r14,%rbp
je     1190 <main+0x50>
movzbl -0x1(%r12),%eax
sub    (%r12),%al
movsbl %al,%edi
call   1040 <abs@plt>
mov    %rax,%rbx
movzbl 0x0(%r13,%r14,1),%eax
sub    -0x1(%r13,%r14,1),%al
movsbl %al,%edi
call   1040 <abs@plt>
add    $0xffffffffffffffff,%r14
add    $0x1,%r12
cmp    %rax,%rbx
je     11e0 <main+0xa0>
lea    0xde5(%rip),%rdi
jmp    1197 <main+0x57>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"Funny\0A\00"
@.str.3 = [11 x i8] c"Not 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
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %69, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %70
13: ; preds = %9
%14 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %6
store i32 0, i32* %4
%18 = load i32, i32* %6
%19 = sub nsw i32 %18, 1
store i32 %19, i32* %5
store i32 1, i32* %7
br label %20
20: ; preds = %61, %13
%21 = load i32, i32* %4
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %62
25: ; preds = %20
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = sub nsw i32 %30, %36
%38 = trunc i32 %37 to i8
%39 = call i64 @abs(i8 signext %38)
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = load i32, i32* %5
%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 %44, %50
%52 = trunc i32 %51 to i8
%53 = call i64 @abs(i8 signext %52)
%54 = icmp eq i64 %39, %53
br i1 %54, label %55, label %60
55: ; preds = %25
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
%58 = load i32, i32* %5
%59 = add nsw i32 %58, -1
store i32 %59, i32* %5
br label %61
60: ; preds = %25
store i32 0, i32* %7
br label %62
61: ; preds = %55
br label %20
62: ; preds = %60, %20
%63 = load i32, i32* %7
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %69
67: ; preds = %62
%68 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %69
69: ; preds = %67, %65
br label %9
70: ; preds = %9
ret i32 0
}

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