#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 main() {
  int i, n;
  char ch[6];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%s", &ch);
    if ((ch[0] == 'o' && ch[1] == 'n') || (ch[0] == 'o' && ch[2] == 'e') ||
        (ch[1] == 'n' && ch[2] == 'e')) {
      printf("1\n");
    } else if ((ch[0] == 't' && ch[1] == 'w') ||
               (ch[0] == 't' && ch[2] == 'o') ||
               (ch[1] == 'w' && ch[2] == 'o')) {
      printf("2\n");
    } else {
      printf("3\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    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1248 <main+0x128>
lea    0xea8(%rip),%rdi
lea    -0x12(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x12(%rbp),%eax
cmp    $0x6f,%eax
jne    1180 <main+0x60>
movsbl -0x11(%rbp),%eax
cmp    $0x6e,%eax
je     11b4 <main+0x94>
movsbl -0x12(%rbp),%eax
cmp    $0x6f,%eax
jne    119a <main+0x7a>
movsbl -0x10(%rbp),%eax
cmp    $0x65,%eax
je     11b4 <main+0x94>
movsbl -0x11(%rbp),%eax
cmp    $0x6e,%eax
jne    11c5 <main+0xa5>
movsbl -0x10(%rbp),%eax
cmp    $0x65,%eax
jne    11c5 <main+0xa5>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
jmp    1235 <main+0x115>
movsbl -0x12(%rbp),%eax
cmp    $0x74,%eax
jne    11df <main+0xbf>
movsbl -0x11(%rbp),%eax
cmp    $0x77,%eax
je     1213 <main+0xf3>
movsbl -0x12(%rbp),%eax
cmp    $0x74,%eax
jne    11f9 <main+0xd9>
movsbl -0x10(%rbp),%eax
cmp    $0x6f,%eax
je     1213 <main+0xf3>
movsbl -0x11(%rbp),%eax
cmp    $0x77,%eax
jne    1224 <main+0x104>
movsbl -0x10(%rbp),%eax
cmp    $0x6f,%eax
jne    1224 <main+0x104>
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
jmp    1230 <main+0x110>
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
jmp    1235 <main+0x115>
jmp    123a <main+0x11a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <main+0x28>
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    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11f9 <main+0xd9>
lea    0xeb0(%rip),%r14
lea    0x12(%rsp),%r15
lea    0xeab(%rip),%rbx
lea    0xea2(%rip),%r12
lea    0xe99(%rip),%r13
xor    %ebp,%ebp
jmp    118e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11f9 <main+0xd9>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movzbl 0x12(%rsp),%edx
movzbl 0x13(%rsp),%eax
cmp    $0x6f,%dl
jne    11b1 <main+0x91>
mov    %rbx,%rdi
cmp    $0x6e,%al
je     1180 <main+0x60>
movzbl 0x14(%rsp),%ecx
cmp    $0x6f,%dl
jne    11c3 <main+0xa3>
mov    %rbx,%rdi
cmp    $0x65,%cl
je     1180 <main+0x60>
cmp    $0x6e,%al
jne    11cf <main+0xaf>
mov    %rbx,%rdi
cmp    $0x65,%cl
je     1180 <main+0x60>
cmp    $0x74,%dl
jne    11db <main+0xbb>
mov    %r12,%rdi
cmp    $0x77,%al
je     1180 <main+0x60>
cmp    $0x74,%dl
jne    11e8 <main+0xc8>
mov    %r12,%rdi
cmp    $0x6f,%cl
je     1180 <main+0x60>
xor    $0x6f,%cl
xor    $0x77,%al
or     %cl,%al
mov    %r12,%rdi
je     1180 <main+0x60>
mov    %r13,%rdi
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x18,%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"1\0A\00"
@.str.3 = [3 x i8] c"2\0A\00"
@.str.4 = [3 x i8] c"3\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [6 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %2
br label %6
6: ; preds = %79, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %82
10: ; preds = %6
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [6 x i8]* %4)
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 111
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 110
br i1 %20, label %41, label %21
21: ; preds = %16, %10
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 111
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 101
br i1 %30, label %41, label %31
31: ; preds = %26, %21
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 110
br i1 %35, label %36, label %43
36: ; preds = %31
%37 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 101
br i1 %40, label %41, label %43
41: ; preds = %36, %26, %16
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %78
43: ; preds = %36, %31
%44 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 116
br i1 %47, label %48, label %53
48: ; preds = %43
%49 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 119
br i1 %52, label %73, label %53
53: ; preds = %48, %43
%54 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 116
br i1 %57, label %58, label %63
58: ; preds = %53
%59 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 111
br i1 %62, label %73, label %63
63: ; preds = %58, %53
%64 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 1
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 119
br i1 %67, label %68, label %75
68: ; preds = %63
%69 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 2
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 111
br i1 %72, label %73, label %75
73: ; preds = %68, %58, %48
%74 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %77
75: ; preds = %68, %63
%76 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %77
77: ; preds = %75, %73
br label %78
78: ; preds = %77, %41
br label %79
79: ; preds = %78
%80 = load i32, i32* %2
%81 = add nsw i32 %80, 1
store i32 %81, i32* %2
br label %6
82: ; preds = %6
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"3\00"
@str.5 = [2 x i8] c"2\00"
@str.6 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [6 x i8], [6 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 slt i32 %6, 1
br i1 %7, label %41, label %8
8: ; preds = %0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 1
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 2
br label %11
11: ; preds = %8, %35
%12 = phi i32 [ 1, %8 ], [ %38, %35 ]
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [6 x i8]* %2)
%14 = load i8, i8* %4
%15 = icmp eq i8 %14, 111
%16 = load i8, i8* %9
%17 = icmp eq i8 %16, 110
%18 = select i1 %15, i1 %17, i1 false
br i1 %18, label %35, label %19
19: ; preds = %11
%20 = load i8, i8* %10
%21 = icmp eq i8 %20, 101
%22 = select i1 %15, i1 %21, i1 false
br i1 %22, label %35, label %23
23: ; preds = %19
%24 = select i1 %17, i1 %21, i1 false
br i1 %24, label %35, label %25
25: ; preds = %23
%26 = icmp eq i8 %14, 116
%27 = icmp eq i8 %16, 119
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %35, label %29
29: ; preds = %25
%30 = icmp eq i8 %20, 111
%31 = select i1 %26, i1 %30, i1 false
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = select i1 %27, i1 %30, i1 false
%34 = select i1 %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0)
br label %35
35: ; preds = %32, %25, %29, %11, %19, %23
%36 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0), %23 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0), %19 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0), %11 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0), %29 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0), %25 ], [ %34, %32 ]
%37 = call i32 @puts(i8* dereferenceable(1) %36)
%38 = add nuw nsw i32 %12, 1
%39 = load i32, i32* %1
%40 = icmp slt i32 %12, %39
br i1 %40, label %11, label %41
41: ; preds = %35, %0
ret i32 0
}