Petya and Gena play a very interesting game "Put a Knight!" on a chessboard *n* × *n* in size. In this game they take turns to put chess pieces called "knights" on the board so that no two knights could threat each other. A knight located in square (*r*, *c*) can threat squares (*r* - 1, *c* + 2), (*r* - 1, *c* - 2), (*r* + 1, *c* + 2), (*r* + 1, *c* - 2), (*r* - 2, *c* + 1), (*r* - 2, *c* - 1), (*r* + 2, *c* + 1) and (*r* + 2, *c* - 1) (some of the squares may be located outside the chessboard). The player who can't put a new knight during his move loses. Determine which player wins considering that both players play optimally well and Petya starts.
The first line contains integer *T* (1 ≤ *T* ≤ 100) — the number of boards, for which you should determine the winning player. Next *T* lines contain *T* integers *n*<sub class="lower-index">*i*</sub> (1 ≤ *n*<sub class="lower-index">*i*</sub> ≤ 10000) — the sizes of the chessboards.
2
2
1
1
0
10
1
2
3
4
5
6
7
8
9
10
0
1
0
1
0
1
0
1
0
1
15
10
4
7
8
9
6
2
1
3
1
5
2
3
4
5
1
1
0
1
0
1
1
0
0
0
0
1
0
1
0
6
10
7
10
8
5
1
1
0
1
1
0
0
100
5
6
8
7
5
7
10
2
8
3
10
3
7
3
2
7
10
3
7
3
9
5
1
1
1
5
7
5
4
8
7
3
2
10
5
10
1
10
5
2
10
6
4
10
7
6
10
8
8
5
5
7
5
7
8
6
7
8
5
8
7
9
1
1
1
5
10
6
3
3
2
7
5
2
4
4
10
1
5
2
9
1
9
9
8
2
6
9
8
2
6
2
1
10
10
8
9
7
8
8
0
1
1
0
0
0
1
1
1
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
0
1
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
0
0
1
1
1
1
0
0
1
0
0
0
0
1
1
1
0
1
1
1
1
0
1
1
1
0
0
1
1
100
59
95
11
67
65
90
93
53
29
63
74
47
5
67
70
67
56
66
10
33
81
63
41
77
62
58
19
95
68
2
99
85
85
94
52
87
20
85
74
58
74
85
76
95
46
1
28
89
100
75
94
46
29
21
89
42
95
72
18
65
73
99
98
59
59
74
80
47
68
58
94
1
63
90
74
77
36
9
13
100
64
55
63
70
97
50
48
7
81
25
31
64
57
12
42
61
95
83
79
84
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
1
1
1
0
0
0
0
0
1
1
0
0
1
1
0
0
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
0
0
1
1
0
0
1
0
1
1
0
0
0
0
1
0
1
1
0
0
0
0
1
100
62
25
86
34
47
37
38
18
42
48
39
59
74
41
58
96
50
19
40
42
43
80
100
64
54
2
36
56
80
77
29
21
87
58
87
92
30
73
87
8
30
98
52
47
67
95
12
87
98
18
16
52
36
1
100
23
49
60
89
14
100
6
34
27
30
81
33
10
59
64
74
33
28
19
78
79
87
98
30
78
42
77
80
87
34
72
19
86
36
19
15
94
61
11
32
91
44
33
32
48
1
0
1
1
0
0
1
1
1
1
0
0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
0
0
0
0
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
1
1
1
1
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
1
1
1
1
0
1
0
1
1
0
1
1
0
0
1
0
0
1
0
1
0
1
1
100
17
6
14
53
81
33
31
31
4
34
4
70
94
64
46
25
92
19
70
4
57
45
59
51
47
45
2
69
91
3
10
4
89
71
21
46
87
60
100
59
37
12
75
98
88
89
49
38
44
14
39
57
95
82
11
56
51
97
9
14
27
14
17
43
2
88
37
21
98
70
55
66
93
47
30
30
87
86
46
56
67
99
98
3
23
42
90
18
91
14
46
73
65
10
70
72
45
31
84
59
0
1
1
0
0
0
0
0
1
1
1
1
1
1
1
0
1
0
1
1
0
0
0
0
0
0
1
0
0
0
1
1
0
0
0
1
0
1
1
0
0
1
0
1
1
0
0
1
1
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
1
1
0
0
1
1
0
1
0
0
1
1
0
1
1
1
0
0
1
0
0
1
1
1
0
1
1
0
0
1
1
1
0
0
1
0
100
20
36
41
21
15
80
24
44
18
20
17
82
63
38
34
53
85
20
48
13
19
11
18
86
39
89
20
30
3
30
39
40
91
35
56
52
97
48
12
9
93
25
50
50
9
32
85
89
42
9
14
15
54
14
70
37
5
86
80
63
6
74
1
11
22
96
89
85
37
76
83
47
58
28
83
32
38
75
63
33
45
70
16
20
59
63
62
97
46
56
30
52
17
60
61
54
94
29
37
71
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
0
0
1
1
0
0
0
1
1
0
0
1
1
0
1
0
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
0
0
1
0
1
0
1
1
1
0
0
1
1
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
1
1
0
0
0
0
1
1
1
0
0
1
0
1
1
1
1
0
1
0
1
1
0
0
0
100
24
18
68
40
49
27
17
9
31
6
81
93
31
12
22
82
27
20
78
23
33
76
78
73
83
32
37
91
15
4
20
75
93
48
91
58
7
36
25
59
1
38
73
1
31
26
69
40
40
53
36
21
12
95
81
17
6
23
52
11
33
81
84
80
94
3
42
48
76
81
64
79
23
56
87
82
89
63
80
11
71
92
33
37
48
33
33
77
1
50
13
82
21
59
51
83
96
27
89
83
1
1
1
1
0
0
0
0
0
1
0
0
0
1
1
1
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
0
1
1
1
0
1
1
1
0
1
0
0
1
0
1
0
0
1
0
0
1
0
0
1
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
100
27
47
95
7
82
22
9
21
45
40
46
5
52
34
10
11
21
73
8
85
95
41
37
8
75
24
3
52
26
31
49
11
95
12
25
12
17
71
37
10
56
51
97
100
52
20
5
91
86
48
59
26
19
27
92
50
8
60
23
11
12
89
68
96
66
58
94
59
15
39
92
12
36
85
39
84
41
52
97
89
48
14
51
53
85
54
4
9
56
44
45
61
25
58
41
65
45
25
42
94
0
0
0
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
1
0
0
0
0
1
0
1
0
1
1
0
0
0
0
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
1
1
0
1
0
0
1
1
1
1
0
0
1
0
1
1
1
1
1
0
0
0
1
1
1
0
0
1
0
1
0
0
1
1
0
0
0
1
1
0
1
1
0
0
0
1
0
0
0
0
1
1
100
30
29
70
26
16
70
2
34
59
26
11
16
20
8
98
39
14
73
38
94
9
6
96
95
67
68
21
13
38
57
30
95
97
25
60
17
75
59
98
60
64
64
72
52
73
15
42
41
84
91
34
32
78
7
51
31
62
49
43
60
40
49
51
64
38
66
46
23
6
45
73
92
1
65
91
86
92
40
14
19
74
36
68
70
22
76
75
88
11
86
28
39
29
9
31
47
46
23
94
6
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
0
1
0
1
1
0
1
1
0
0
1
0
0
1
0
1
0
0
0
1
0
0
0
1
1
1
1
1
1
0
0
1
0
1
0
1
1
1
0
0
0
1
0
0
1
1
0
0
1
1
1
1
0
1
0
0
1
0
0
0
1
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
0
0
0
0
0
1
0
1
1
100
34
58
97
93
50
17
95
47
72
11
76
28
89
82
86
68
56
74
68
4
72
24
3
82
60
11
39
74
50
32
59
30
99
89
94
71
84
46
10
10
19
30
95
3
94
57
26
40
82
87
56
38
37
40
62
64
64
86
14
8
19
57
87
80
58
73
99
86
45
51
53
25
66
94
95
36
43
29
31
97
52
58
86
87
10
45
46
68
66
80
60
70
33
8
22
28
96
21
47
18
1
1
0
0
1
0
0
0
1
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
0
0
0
1
1
0
0
1
0
0
0
0
1
1
0
1
0
0
0
0
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
0
0
1
100
37
88
24
60
84
12
40
12
86
97
88
39
9
4
74
97
50
75
46
65
86
89
62
17
52
55
4
88
61
58
88
66
1
2
29
77
94
34
23
9
27
43
71
55
67
52
62
91
80
82
79
95
95
20
73
45
18
23
85
9
46
64
70
48
30
80
51
97
84
57
82
57
31
22
47
39
95
17
96
74
30
81
4
3
47
67
17
99
21
74
43
49
37
6
12
58
97
20
51
30
0
1
1
1
1
1
1
1
1
0
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
1
1
0
1
0
0
1
1
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
1
0
0
1
0
0
0
1
1
1
1
1
1
0
0
1
0
1
0
0
1
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
1
0
0
0
1
1
1
0
1
0
1
100
91
83
93
95
65
56
2
7
85
42
28
26
84
62
65
23
78
49
15
100
72
86
71
19
5
71
49
100
29
59
92
82
41
53
50
57
98
80
5
65
58
68
58
72
8
64
67
44
5
79
3
59
19
22
33
85
63
23
62
50
67
52
9
14
29
31
46
3
60
82
60
12
89
87
95
51
87
54
16
36
67
90
72
77
10
14
9
76
92
82
85
59
87
75
52
76
79
24
33
76
0
0
0
0
0
1
1
0
0
1
1
1
1
1
0
0
1
0
0
1
1
1
0
0
0
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
1
1
1
1
1
1
0
1
0
0
0
0
0
1
0
0
0
0
1
1
0
1
0
1
0
0
1
0
1
1
1
1
0
0
0
0
0
1
1
1
0
1
1
0
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
1
for t in range(int(input())):
    print(str((int(input())-1)%2))