#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 abs(int);
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int i, j, m, n, t;
  char a, b, c, x, y, z, f;
  scanf("%d", &t);
  getchar();
  for (i = 0; i < t; i++) {
    m = 0;
    n = 0;
    a = getchar();
    b = getchar();
    c = getchar();
    m = (((a - 65) * 676) + ((b - 65) * 26) + (c - 65));
    getchar();
    x = getchar();
    y = getchar();
    z = getchar();
    f = getchar();
    n = (((x - 48) * 1000) + ((y - 48) * 100) + ((z - 48) * 10) + (f - 48));
    j = abs(m - n);
    if (j <= 100)
      printf("nice\n");
    else
      printf("not nice\n");
    getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1274 <main+0x134>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x19(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1a(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1b(%rbp)
movsbl -0x19(%rbp),%eax
sub    $0x41,%eax
imul   $0x2a4,%eax,%eax
movsbl -0x1a(%rbp),%ecx
sub    $0x41,%ecx
imul   $0x1a,%ecx,%ecx
add    %ecx,%eax
movsbl -0x1b(%rbp),%ecx
sub    $0x41,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1d(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1e(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1f(%rbp)
movsbl -0x1c(%rbp),%eax
sub    $0x30,%eax
imul   $0x3e8,%eax,%eax
movsbl -0x1d(%rbp),%ecx
sub    $0x30,%ecx
imul   $0x64,%ecx,%ecx
add    %ecx,%eax
movsbl -0x1e(%rbp),%ecx
sub    $0x30,%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
movsbl -0x1f(%rbp),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jg     1253 <main+0x113>
lea    0xdbe(%rip),%rdi
call   1040 <printf@plt>
jmp    125f <main+0x11f>
lea    0xda9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x2d>
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
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    1239 <main+0x109>
lea    0xe9e(%rip),%r12
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %bpl,%ecx
imul   $0x2a4,%ecx,%ecx
movsbl %bl,%edx
lea    (%rdx,%rdx,4),%esi
lea    (%rsi,%rsi,4),%esi
add    %edx,%esi
add    %ecx,%esi
movsbl %al,%r15d
add    %esi,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %bpl,%ecx
movsbl %r14b,%edx
movsbl %bl,%esi
movsbl %al,%eax
imul   $0xfffffc18,%ecx,%ecx
add    %r15d,%ecx
imul   $0xffffff9c,%edx,%edx
add    %ecx,%edx
add    %esi,%esi
lea    (%rsi,%rsi,4),%ecx
sub    %ecx,%edx
sub    %eax,%edx
lea    0x1dd1(%rdx),%eax
lea    0x1dd1(%rdx),%ecx
neg    %ecx
cmp    $0xffffe22f,%edx
cmovge %eax,%ecx
cmp    $0x65,%ecx
mov    %r12,%rdi
lea    0xded(%rip),%rax
cmovl  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%r13d
cmp    0x4(%rsp),%r13d
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%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 = [6 x i8] c"nice\0A\00"
@.str.2 = [10 x i8] c"not nice\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
store i32 0, i32* %1
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%15 = call signext i8 (...) @getchar()
store i32 0, i32* %2
br label %16
16: ; preds = %72, %0
%17 = load i32, i32* %2
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %75
20: ; preds = %16
store i32 0, i32* %4
store i32 0, i32* %5
%21 = call signext i8 (...) @getchar()
store i8 %21, i8* %7
%22 = call signext i8 (...) @getchar()
store i8 %22, i8* %8
%23 = call signext i8 (...) @getchar()
store i8 %23, i8* %9
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 65
%27 = mul nsw i32 %26, 676
%28 = load i8, i8* %8
%29 = sext i8 %28 to i32
%30 = sub nsw i32 %29, 65
%31 = mul nsw i32 %30, 26
%32 = add nsw i32 %27, %31
%33 = load i8, i8* %9
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 65
%36 = add nsw i32 %32, %35
store i32 %36, i32* %4
%37 = call signext i8 (...) @getchar()
%38 = call signext i8 (...) @getchar()
store i8 %38, i8* %10
%39 = call signext i8 (...) @getchar()
store i8 %39, i8* %11
%40 = call signext i8 (...) @getchar()
store i8 %40, i8* %12
%41 = call signext i8 (...) @getchar()
store i8 %41, i8* %13
%42 = load i8, i8* %10
%43 = sext i8 %42 to i32
%44 = sub nsw i32 %43, 48
%45 = mul nsw i32 %44, 1000
%46 = load i8, i8* %11
%47 = sext i8 %46 to i32
%48 = sub nsw i32 %47, 48
%49 = mul nsw i32 %48, 100
%50 = add nsw i32 %45, %49
%51 = load i8, i8* %12
%52 = sext i8 %51 to i32
%53 = sub nsw i32 %52, 48
%54 = mul nsw i32 %53, 10
%55 = add nsw i32 %50, %54
%56 = load i8, i8* %13
%57 = sext i8 %56 to i32
%58 = sub nsw i32 %57, 48
%59 = add nsw i32 %55, %58
store i32 %59, i32* %5
%60 = load i32, i32* %4
%61 = load i32, i32* %5
%62 = sub nsw i32 %60, %61
%63 = call i32 @abs(i32 %62)
store i32 %63, i32* %3
%64 = load i32, i32* %3
%65 = icmp sle i32 %64, 100
br i1 %65, label %66, label %68
66: ; preds = %20
%67 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %70
68: ; preds = %20
%69 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %70
70: ; preds = %68, %66
%71 = call signext i8 (...) @getchar()
br label %72
72: ; preds = %70
%73 = load i32, i32* %2
%74 = add nsw i32 %73, 1
store i32 %74, i32* %2
br label %16
75: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [9 x i8] c"not nice\00"
@str.3 = [5 x i8] c"nice\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call signext i8 (...) @getchar()
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %46
7: ; preds = %0, %7
%8 = phi i32 [ %43, %7 ], [ 0, %0 ]
%9 = call signext i8 (...) @getchar()
%10 = call signext i8 (...) @getchar()
%11 = call signext i8 (...) @getchar()
%12 = sext i8 %9 to i32
%13 = mul nsw i32 %12, 676
%14 = sext i8 %10 to i32
%15 = mul nsw i32 %14, 26
%16 = sext i8 %11 to i32
%17 = call signext i8 (...) @getchar()
%18 = call signext i8 (...) @getchar()
%19 = call signext i8 (...) @getchar()
%20 = call signext i8 (...) @getchar()
%21 = call signext i8 (...) @getchar()
%22 = sext i8 %18 to i32
%23 = sext i8 %19 to i32
%24 = sext i8 %20 to i32
%25 = sext i8 %21 to i32
%26 = mul nsw i32 %22, -1000
%27 = mul nsw i32 %23, -100
%28 = mul nsw i32 %24, -10
%29 = add nsw i32 %15, %13
%30 = add nsw i32 %29, %16
%31 = add nsw i32 %30, %26
%32 = add nsw i32 %31, %27
%33 = add nsw i32 %32, %28
%34 = sub nsw i32 %33, %25
%35 = add nsw i32 %34, 7633
%36 = icmp slt i32 %34, -7633
%37 = sub nsw i32 -7633, %34
%38 = select i1 %36, i32 %37, i32 %35
%39 = icmp slt i32 %38, 101
%40 = select i1 %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0)
%41 = call i32 @puts(i8* dereferenceable(1) %40)
%42 = call signext i8 (...) @getchar()
%43 = add nuw nsw i32 %8, 1
%44 = load i32, i32* %1
%45 = icmp slt i32 %43, %44
br i1 %45, label %7, label %46
46: ; preds = %7, %0
ret i32 0
}