#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 strlen(char *);
int main() {
  int n, i, len;
  scanf("%d", &n);
  char s[1000];
  for (i = 0; i < n; i++) {
    scanf("%s", s);
    len = strlen(s);
    if (s[len - 1] == '5' && s[len - 2] == '3')
      printf("-\n");
    else if (s[0] == '9' && s[len - 1] == '4')
      printf("*\n");
    else if (s[0] == '1' && s[1] == '9' && s[2] == '0')
      printf("?\n");
    else
      printf("+\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1272 <main+0x142>
lea    -0x400(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x35,%eax
jne    11ce <main+0x9e>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x33,%eax
jne    11ce <main+0x9e>
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
jmp    125f <main+0x12f>
movsbl -0x400(%rbp),%eax
cmp    $0x39,%eax
jne    1208 <main+0xd8>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x34,%eax
jne    1208 <main+0xd8>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
jmp    125a <main+0x12a>
movsbl -0x400(%rbp),%eax
cmp    $0x31,%eax
jne    1249 <main+0x119>
movsbl -0x3ff(%rbp),%eax
cmp    $0x39,%eax
jne    1249 <main+0x119>
movsbl -0x3fe(%rbp),%eax
cmp    $0x30,%eax
jne    1249 <main+0x119>
lea    0xdcd(%rip),%rdi
call   1040 <printf@plt>
jmp    1255 <main+0x125>
lea    0xdbf(%rip),%rdi
call   1040 <printf@plt>
jmp    125a <main+0x12a>
jmp    125f <main+0x12f>
jmp    1264 <main+0x134>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <main+0x2b>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1209 <main+0xd9>
lea    0xe9d(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe9a(%rip),%r15
lea    0xe8f(%rip),%r12
lea    0xe86(%rip),%r13
xor    %ebp,%ebp
jmp    11bb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    $0x31,%al
movzbl 0x11(%rsp),%ecx
movzbl 0x12(%rsp),%edx
xor    $0x39,%cl
or     %al,%cl
xor    $0x30,%dl
or     %cl,%dl
mov    %r13,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    1209 <main+0xd9>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movzbl -0x1(%rax,%rbx,1),%ecx
cmp    $0x35,%cl
jne    11f0 <main+0xc0>
cmpb   $0x33,-0x2(%rax,%rbx,1)
mov    %r15,%rdi
je     11ad <main+0x7d>
movzbl 0x10(%rsp),%eax
jmp    1190 <main+0x60>
nopl   (%rax)
movzbl 0x10(%rsp),%eax
cmp    $0x39,%al
jne    1190 <main+0x60>
mov    $0x39,%al
lea    0xe08(%rip),%rdi
cmp    $0x34,%cl
jne    1190 <main+0x60>
jmp    11ad <main+0x7d>
xor    %eax,%eax
add    $0x3f8,%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 = [3 x i8] c"-\0A\00"
@.str.3 = [3 x i8] c"*\0A\00"
@.str.4 = [3 x i8] c"?\0A\00"
@.str.5 = [3 x i8] c"+\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000 x i8]
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)
store i32 0, i32* %3
br label %7
7: ; preds = %70, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %73
11: ; preds = %7
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, 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)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 53
br i1 %22, label %23, label %33
23: ; preds = %11
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 51
br i1 %30, label %31, label %33
31: ; preds = %23
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %69
33: ; preds = %23, %11
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 57
br i1 %37, label %38, label %48
38: ; preds = %33
%39 = load i32, i32* %4
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 52
br i1 %45, label %46, label %48
46: ; preds = %38
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %68
48: ; preds = %38, %33
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 49
br i1 %52, label %53, label %65
53: ; preds = %48
%54 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 1
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 57
br i1 %57, label %58, label %65
58: ; preds = %53
%59 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 2
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 48
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %67
65: ; preds = %58, %53, %48
%66 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %67
67: ; preds = %65, %63
br label %68
68: ; preds = %67, %46
br label %69
69: ; preds = %68, %31
br label %70
70: ; preds = %69
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 1
store i32 %72, i32* %3
br label %7
73: ; preds = %7
ret i32 0
}

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