QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#291862#5703. Mixturemonstersqwq100 ✓94ms13096kbC++201.7kb2023-12-27 10:17:322023-12-27 10:17:33

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 13
Accepted

Test #1:

score: 13
Accepted
time: 0ms
memory: 5924kb

input:

1 2 3
6
A 5 6 7
A 3 10 17
R 1
A 15 18 21
A 5 10 15
R 3

output:

0
2
0
2
1
1

result:

ok 6 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 5964kb

input:

1 2 3
9
A 5 6 7
A 3 10 17
A 5 6 27
A 5 10 15
R 4
R 2
A 2 1 3
A 3 2 1
A 3 1 2

output:

0
2
2
1
2
0
0
0
0

result:

ok 9 lines

Test #3:

score: 0
Accepted
time: 1ms
memory: 7972kb

input:

4 4 2
50
A 0 0 10
A 1 0 9
A 0 1 9
A 1 1 8
A 2 0 8
A 0 2 8
A 2 1 7
A 1 2 7
A 3 0 7
A 0 3 7
A 2 2 6
A 1 3 6
A 3 1 6
A 2 3 5
A 3 2 5
A 3 3 4
A 1 8 1
A 8 1 1
A 0 8 2
A 7 2 1
A 7 0 3
A 4 0 6
A 5 0 5
A 0 4 6
A 0 5 5
R 1
R 3
R 5
R 7
R 9
R 11
R 13
R 15
R 17
R 19
R 21
R 23
R 25
R 24
R 22
R 20
R 18
R 16
R 14
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 50 lines

Test #4:

score: 0
Accepted
time: 1ms
memory: 5960kb

input:

1 2 3
7
A 1 3 2
A 3 1 2
A 3 2 1
A 0 1 5
A 2 1 3
A 2 3 1
A 2 4 6

output:

0
0
0
3
3
2
1

result:

ok 7 lines

Test #5:

score: 0
Accepted
time: 1ms
memory: 8000kb

input:

7 4 9
10
A 20 34 4
A 16 43 34
A 10 30 58
R 1
A 16 12 72
A 11 8 55
A 12 14 63
A 12 43 42
A 12 35 4
A 14 23 14

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 lines

Test #6:

score: 0
Accepted
time: 1ms
memory: 5932kb

input:

1 1 1
25
A 33 20 13
A 29 3 40
A 71 4 25
A 29 9 1
A 40 16 22
A 69 11 3
A 1 7 16
A 28 5 64
A 57 11 1
A 7 33 20
A 5 4 44
A 4 9 44
A 91 0 0
A 2 15 3
A 8 10 5
A 34 34 17
A 4 35 54
A 12 72 9
A 41 15 16
A 21 0 26
A 3 43 38
A 6 57 22
A 5 10 18
R 18
A 74 6 12

output:

0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3

result:

ok 25 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 8004kb

input:

21 33 9
50
A 6 61 33
A 5 23 72
A 5 61 34
A 5 52 43
A 5 88 7
A 5 32 63
A 6 19 75
A 6 44 50
A 6 70 24
A 6 77 17
A 6 18 76
A 6 59 35
A 5 36 59
A 6 28 66
A 5 92 3
A 5 86 9
A 6 13 81
A 5 35 60
A 5 41 54
A 6 84 10
A 6 5 89
A 5 47 48
A 5 63 32
A 5 84 11
A 5 86 9
A 6 42 52
A 6 25 69
A 5 4 91
A 5 45 50
A 5 5...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1

result:

ok 50 lines

Test #8:

score: 0
Accepted
time: 1ms
memory: 7972kb

input:

6 41 53
50
A 5 77 18
A 5 81 14
A 6 25 69
A 6 21 73
A 6 66 28
A 6 57 37
A 6 38 56
R 4
A 5 41 54
A 5 65 30
R 3
A 6 35 59
R 6
A 5 72 23
R 7
A 6 37 57
A 5 42 53
R 5
A 5 9 86
A 5 70 25
R 12
A 5 49 46
A 6 78 16
A 6 88 6
A 5 36 59
R 17
R 10
A 6 27 67
A 5 27 68
A 6 69 25
R 2
A 6 90 4
A 5 33 62
A 5 26 69
A 6...

output:

0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
0
0
0
0
0
2
2
2
2
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
0
0
0
0
0
2
0

result:

ok 50 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 8000kb

input:

0 3 2
13
A 0 5 5
R 1
A 1 3 6
A 0 6 4
R 2
A 5 3 2
R 3
A 1 3 6
A 7 2 1
A 2 1 7
R 4
A 6 4 0
R 5

output:

0
0
0
1
1
1
0
0
0
0
0
0
0

result:

ok 13 lines

Test #10:

score: 0
Accepted
time: 1ms
memory: 5924kb

input:

3 3 4
13
A 0 5 5
R 1
A 1 3 6
A 0 6 4
R 2
A 5 3 2
R 3
A 1 3 6
A 7 2 1
A 2 1 7
R 4
A 6 4 0
R 5

output:

0
0
0
0
0
0
0
2
2
2
0
3
0

result:

ok 13 lines

Test #11:

score: 0
Accepted
time: 1ms
memory: 7988kb

input:

15 9 6
20
A 5 3 2
A 25 15 10
A 5 3 2
A 15 9 6
R 4
A 7 2 2
R 3
A 8 7 4
R 2
A 10 9 6
R 1
A 5 0 0
R 5
R 6
A 0 3 0
R 7
A 0 0 2
R 8
R 9
R 10

output:

1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
0
3
0
0
0

result:

ok 20 lines

Test #12:

score: 0
Accepted
time: 1ms
memory: 7924kb

input:

1 2 4
33
A 5 5 4
A 5 6 26
A 1 26 64
A 19 26 46
A 4 3 0
A 1 7 20
A 5 12 17
A 1 0 7
A 16 26 49
A 7 9 12
A 10 26 55
A 13 11 4
A 5 2 32
A 1 26 64
A 13 26 52
A 5 8 23
R 15
R 6
R 11
R 7
A 5 12 17
R 12
R 1
R 5
R 2
R 8
R 3
R 9
R 4
R 17
R 16
R 14
R 13

output:

0
0
3
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
0
0

result:

ok 33 lines

Test #13:

score: 0
Accepted
time: 1ms
memory: 5956kb

input:

5 3 2
15
A 2 14 4
A 4 12 4
A 14 26 10
R 1
A 3 5 2
A 20 12 8
A 2 14 4
A 13 27 10
R 5
A 15 25 10
A 7 1 2
A 1 7 2
R 3
R 2
R 4

output:

0
0
0
0
0
1
1
1
0
0
2
2
2
2
2

result:

ok 15 lines

Test #14:

score: 0
Accepted
time: 1ms
memory: 5860kb

input:

1 1 1
50
A 11 28 36
R 1
A 39 22 14
A 53 19 3
R 2
A 25 25 25
R 3
R 4
A 25 25 25
A 11 28 36
A 53 19 3
A 11 28 36
A 11 28 36
A 39 22 14
A 53 19 3
A 25 25 25
A 25 25 25
A 11 28 36
A 39 22 14
A 25 25 25
A 25 25 25
A 11 28 36
A 53 19 3
A 11 28 36
A 39 22 14
A 25 25 25
A 39 22 14
A 39 22 14
R 12
R 5
A 39 2...

output:

0
0
0
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

ok 50 lines

Test #15:

score: 0
Accepted
time: 1ms
memory: 5932kb

input:

1 1 1
50
A 17 33 1
R 1
A 17 7 27
R 2
A 17 29 5
A 17 25 9
A 17 33 1
A 17 21 13
R 3
A 17 11 23
A 17 23 11
A 17 13 21
A 17 23 11
A 17 21 13
A 17 5 29
A 17 23 11
A 17 25 9
A 17 9 25
A 17 5 29
R 4
R 5
A 17 15 19
A 17 5 29
R 7
A 17 23 11
A 17 19 15
A 17 31 3
A 17 9 25
R 6
R 8
A 17 9 25
A 17 1 33
A 17 29 5...

output:

0
0
0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2

result:

ok 50 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 5880kb

input:

0 1 1
50
A 34 57 1
A 42 19 31
A 42 19 31
A 34 57 1
A 46 0 46
A 34 57 1
A 38 38 16
A 46 0 46
A 38 38 16
R 9
A 38 38 16
A 34 57 1
A 42 19 31
A 42 19 31
A 38 38 16
A 38 38 16
A 42 19 31
A 34 57 1
A 46 0 46
R 12
A 38 38 16
A 34 57 1
A 46 0 46
A 42 19 31
A 34 57 1
A 38 38 16
A 34 57 1
A 46 0 46
A 46 0 46...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2

result:

ok 50 lines

Test #17:

score: 0
Accepted
time: 1ms
memory: 5928kb

input:

0 7 0
49
A 2 0 81
A 89 4 4
A 10 0 60
A 15 16 16
A 77 0 6
R 1
A 61 0 22
A 49 24 24
A 53 22 22
A 4 0 79
A 87 5 5
A 85 6 6
A 41 0 42
A 95 1 1
A 0 0 17
A 56 0 14
A 69 0 1
A 73 0 10
A 32 0 51
A 30 0 40
A 49 0 34
A 75 0 8
A 3 47 47
R 4
R 15
A 21 0 49
A 25 11 11
A 25 0 58
A 47 0 36
A 38 0 0
A 63 0 7
A 43 2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1

result:

ok 49 lines

Test #18:

score: 0
Accepted
time: 1ms
memory: 5912kb

input:

0 0 3
50
A 10 0 74
R 1
A 0 0 84
A 0 60 12
A 5 5 17
A 5 5 35
A 0 19 53
A 0 71 4
A 9 9 0
A 16 0 68
A 41 0 43
A 41 0 34
R 7
A 32 0 25
A 0 68 4
R 8
R 4
A 8 0 67
A 0 1 71
A 26 0 31
A 36 0 39
A 13 13 1
R 14
R 2
A 0 41 31
A 0 23 49
A 0 0 33
A 0 11 25
R 5
A 0 1 71
A 43 0 14
A 0 0 27
A 3 0 30
A 8 0 67
A 0 32...

output:

0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

ok 50 lines

Test #19:

score: 0
Accepted
time: 1ms
memory: 5924kb

input:

1 2 3
50
A 15 15 30
R 1
A 37 8 45
A 26 17 11
A 7 38 45
A 18 4 32
A 18 28 8
R 2
R 5
A 45 0 45
A 29 20 5
A 28 8 48
R 3
A 28 23 33
A 33 12 45
A 18 8 28
A 23 12 31
R 6
R 11
A 28 50 6
A 23 7 30
A 32 16 48
A 26 4 30
A 1 1 4
A 11 34 45
A 9 3 6
A 33 0 33
A 6 12 0
A 2 3 13
A 14 3 1
A 14 3 49
A 23 14 17
A 13 ...

output:

0
0
0
0
2
2
2
3
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2

result:

ok 50 lines

Subtask #2:

score: 17
Accepted

Dependency #1:

100%
Accepted

Test #20:

score: 17
Accepted
time: 0ms
memory: 7972kb

input:

11 44 22
100
A 234 55 124
A 250 87 76
A 220 27 166
A 240 67 106
A 236 59 118
A 208 3 202
A 13 52 26
R 7
R 1
R 2
A 258 103 52
A 218 23 172
R 3
A 222 31 160
A 274 135 4
A 272 131 10
A 262 111 40
R 4
A 260 107 46
R 6
A 214 15 184
A 244 75 94
A 266 119 28
A 240 67 106
A 274 135 4
R 14
A 242 71 100
A 212...

output:

0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 100 lines

Test #21:

score: 0
Accepted
time: 1ms
memory: 7928kb

input:

4 1 2
100
A 234 55 124
A 250 87 76
A 220 27 166
A 240 67 106
A 236 59 118
A 208 3 202
A 226 39 148
R 7
R 1
R 2
A 258 103 52
A 218 23 172
R 3
A 222 31 160
A 274 135 4
A 272 131 10
A 262 111 40
R 4
A 260 107 46
R 6
A 214 15 184
A 244 75 94
A 266 119 28
A 240 67 106
A 274 135 4
R 14
A 242 71 100
A 212 ...

output:

0
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2

result:

ok 100 lines

Test #22:

score: 0
Accepted
time: 1ms
memory: 8020kb

input:

33 37 41
337
A 37 33 41
A 34 33 44
A 74 66 82
A 33 33 45
A 32 33 46
A 36 33 42
A 148 132 164
A 111 99 123
R 7
R 6
A 37 33 41
A 34 33 44
A 33 33 45
A 36 33 42
R 10
A 74 66 82
A 37 33 41
A 34 33 44
R 2
A 74 66 82
A 33 33 45
A 33 33 45
A 37 33 41
A 35 33 43
A 111 99 123
A 111 99 123
A 31 33 47
A 111 99...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 337 lines

Test #23:

score: 0
Accepted
time: 1ms
memory: 7960kb

input:

1 2 1
500
A 375 261 16
A 52 103 257
A 240 166 258
A 414 256 158
A 350 217 189
R 1
A 349 194 181
A 4 65 23
A 68 53 91
A 48 60 36
A 258 171 87
A 423 220 169
A 468 207 153
A 374 196 190
A 289 278 189
A 334 179 139
A 346 269 77
A 478 303 175
A 303 240 181
A 12 6 150
A 120 166 166
A 245 134 65
A 282 159 ...

output:

0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 500 lines

Test #24:

score: 0
Accepted
time: 1ms
memory: 5880kb

input:

117 117 234
500
A 213 213 426
R 1
A 35 35 70
A 206 206 412
R 3
A 150 150 300
A 216 216 432
A 115 115 230
A 89 89 178
A 13 13 26
A 148 148 296
A 118 118 236
A 120 120 240
A 229 229 458
A 144 144 288
A 63 63 126
A 217 217 434
A 7 7 14
A 35 35 70
A 213 213 426
R 11
R 7
A 53 53 106
A 227 227 454
A 5 5 1...

output:

1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500 lines

Test #25:

score: 0
Accepted
time: 1ms
memory: 5896kb

input:

1 1 1
499
A 215 214 215
A 9 10 10
A 311 310 311
A 167 167 159
R 1
A 63 63 62
A 225 225 224
A 97 98 86
A 204 208 207
A 122 123 123
A 110 118 118
A 110 111 110
R 2
R 3
A 226 232 227
R 5
A 104 104 103
A 160 160 153
A 64 63 57
A 262 263 262
A 113 114 114
A 88 89 89
A 86 91 89
A 123 122 123
A 253 254 254...

output:

0
0
0
3
3
3
3
3
3
3
3
2
2
0
0
0
0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 499 lines

Test #26:

score: 0
Accepted
time: 1ms
memory: 5948kb

input:

1 1 1
497
A 291 290 291
R 1
A 132 131 132
A 34 33 33
R 2
A 15 14 15
A 221 220 221
A 73 74 73
A 211 211 210
A 99 100 100
A 181 181 182
A 221 220 221
A 135 135 134
A 250 251 251
A 300 301 300
A 290 290 289
A 300 301 300
A 20 21 21
A 135 135 134
A 135 135 134
A 257 257 256
R 7
A 290 290 289
A 204 203 2...

output:

0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 497 lines

Test #27:

score: 0
Accepted
time: 1ms
memory: 5896kb

input:

37 26 16
500
A 106 75 45
A 231 165 98
A 434 310 185
A 371 266 159
R 3
R 4
R 1
A 21 14 9
R 2
A 252 180 107
A 91 65 40
A 281 200 120
A 134 95 57
A 77 55 34
R 9
A 160 115 69
A 63 44 27
A 217 155 94
A 50 35 21
A 175 125 74
A 231 165 98
R 8
R 11
A 106 75 45
A 77 55 34
A 315 225 134
A 280 200 121
R 5
A 36...

output:

0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 500 lines

Test #28:

score: 0
Accepted
time: 1ms
memory: 5988kb

input:

13 0 11
495
A 7 1 21
A 74 0 225
A 127 0 380
A 48 0 143
A 146 5 420
A 140 0 417
A 79 4 248
A 160 3 474
A 241 1 723
A 182 1 546
A 146 5 420
R 1
A 74 0 225
A 84 1 240
A 145 0 438
R 6
A 77 0 234
A 150 5 436
A 186 4 539
A 159 1 477
A 110 1 326
A 240 0 723
A 25 0 78
A 215 0 642
A 122 1 354
A 52 0 159
A 14...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 495 lines

Test #29:

score: 0
Accepted
time: 0ms
memory: 5888kb

input:

218 179 84
333
A 255 195 105
A 214 163 104
A 181 138 88
R 1
A 377 272 128
A 303 224 102
A 30 26 18
A 380 270 164
A 228 164 126
A 374 308 132
A 318 228 120
A 432 343 150
A 409 347 243
A 257 209 126
A 287 236 106
A 387 318 146
A 354 266 120
R 9
A 354 284 176
A 409 334 182
A 401 351 173
R 14
R 12
A 354...

output:

0
0
0
0
0
0
0
0
0
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 333 lines

Test #30:

score: 0
Accepted
time: 1ms
memory: 8008kb

input:

150 102 81
333
A 255 195 105
A 214 163 104
A 181 138 88
R 1
A 377 272 128
A 303 224 102
A 30 26 18
A 380 270 164
A 228 164 126
A 374 308 132
A 318 228 120
A 432 343 150
A 409 347 243
A 257 209 126
A 287 236 106
A 387 318 146
A 354 266 120
R 9
A 354 284 176
A 409 334 182
A 401 351 173
R 14
R 12
A 354...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
...

result:

ok 333 lines

Test #31:

score: 0
Accepted
time: 1ms
memory: 7976kb

input:

21 69 9
500
A 154 506 66
A 56 184 24
A 154 506 66
A 21 69 9
R 1
A 210 690 90
R 5
R 2
R 3
A 210 690 90
R 6
A 154 506 66
R 4
A 77 253 33
R 7
A 98 322 42
R 8
A 91 299 39
R 9
A 14 46 6
R 10
A 84 276 36
R 11
A 196 644 84
R 12
R 13
A 35 115 15
A 189 621 81
R 14
A 182 598 78
A 133 437 57
R 15
R 16
R 17
A 1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500 lines

Test #32:

score: 0
Accepted
time: 1ms
memory: 5952kb

input:

22 250 107
498
A 41 448 170
A 51 484 216
A 3 32 11
A 19 280 123
A 14 123 52
A 17 250 110
A 67 608 266
A 68 633 240
A 37 307 127
A 37 392 183
A 48 542 208
A 29 318 122
A 45 369 149
A 30 408 172
R 5
A 31 436 192
A 43 342 133
A 44 551 252
R 6
A 28 433 196
A 53 431 175
A 30 350 136
A 20 155 59
A 65 530 ...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 498 lines

Test #33:

score: 0
Accepted
time: 0ms
memory: 5884kb

input:

210 690 89
500
A 154 506 66
A 56 184 24
A 154 506 66
A 21 69 9
R 1
A 210 690 88
R 2
R 3
A 210 690 90
R 6
A 154 506 66
R 4
A 77 253 33
R 7
A 98 322 42
R 8
A 91 299 39
R 9
A 14 46 6
R 10
A 84 276 36
R 11
A 196 644 84
R 12
R 13
A 35 115 15
A 189 621 81
R 14
A 182 598 78
A 133 437 57
R 15
R 16
R 17
A 13...

output:

0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
2
2
2
2
2
2
2
0
2
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 500 lines

Test #34:

score: 0
Accepted
time: 1ms
memory: 8000kb

input:

12 1 19
500
A 228 12 240
A 6 154 160
R 1
A 13 99 112
A 620 144 188
A 258 21 195
A 412 1 409
A 42 193 67
A 157 35 52
A 451 126 73
A 105 319 4
A 342 97 51
R 6
A 92 127 219
A 569 156 101
A 107 202 309
A 1 312 313
A 44 319 363
A 71 79 150
A 95 152 247
R 8
A 276 65 341
A 400 64 208
A 215 60 35
A 41 149 2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 500 lines

Test #35:

score: 0
Accepted
time: 1ms
memory: 7912kb

input:

11 13 0
479
A 174 290 486
R 1
A 290 97 232
A 74 291 183
R 3
R 2
A 19 217 0
A 10 161 0
R 4
R 5
A 91 128 0
R 6
A 44 290 240
R 7
A 75 76 0
R 8
A 1 56 0
A 159 290 35
R 9
A 236 291 364
R 10
R 11
A 290 285 95
R 12
A 290 17 297
A 238 98 0
A 284 109 1
A 289 205 291
R 13
R 15
R 14
A 154 290 339
R 17
A 13 147...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 479 lines

Test #36:

score: 0
Accepted
time: 0ms
memory: 5872kb

input:

10 65 2
479
A 174 290 486
R 1
A 290 97 232
A 74 291 183
R 3
R 2
A 19 217 0
A 10 161 0
R 4
R 5
A 91 128 0
R 6
A 44 290 240
R 7
A 75 76 0
R 8
A 1 56 0
A 159 290 35
R 9
A 236 291 364
R 10
R 11
A 290 285 95
R 12
A 290 17 297
A 238 98 0
A 284 109 1
A 289 205 291
R 13
R 15
R 14
A 154 290 339
R 17
A 13 147...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 479 lines

Subtask #3:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #37:

score: 30
Accepted
time: 1ms
memory: 5936kb

input:

69 57 68
750
A 2534 2184 2072
A 257 205 217
R 2
R 1
A 256 199 224
R 3
A 680 562 504
A 1798 1798 2030
A 689 565 589
A 2256 2034 2112
R 4
A 1125 921 961
R 5
A 486 411 364
A 476 395 390
A 247 208 224
A 2871 2705 2475
R 11
A 3054 2562 1950
A 2024 1847 1852
R 8
A 718 631 494
R 7
R 13
A 2646 2156 1988
A 2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 750 lines

Test #38:

score: 0
Accepted
time: 1ms
memory: 5972kb

input:

3333 3331 3329
750
A 2534 2184 2072
A 257 205 217
R 2
R 1
A 256 199 224
R 3
A 580 572 564
A 1798 1798 1798
A 689 687 685
A 2056 2034 2012
R 4
A 1125 921 961
R 5
A 486 411 364
A 476 395 390
A 247 208 224
A 2871 2705 2475
R 11
A 3054 2562 1950
A 2024 1847 1852
R 8
A 718 631 494
R 7
R 13
A 2646 2156 19...

output:

0
0
0
0
0
0
0
2
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 750 lines

Test #39:

score: 0
Accepted
time: 1ms
memory: 6008kb

input:

11 7 13
813
A 540 1070 560
A 1956 1029 208
A 260 430 240
A 77 199 1863
A 3401 1826 1748
A 748 503 268
A 658 511 350
R 3
R 2
A 1199 1115 445
A 2922 5178 270
A 1537 5191 1363
A 1355 2803 1701
A 3380 1672 2512
A 1116 1314 5940
A 1324 1172 3952
A 287 545 501
A 3032 120 72
A 102 342 486
A 2234 3706 2430
...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 813 lines

Test #40:

score: 0
Accepted
time: 0ms
memory: 5964kb

input:

1101 701 1301
813
A 540 1070 560
A 1956 1029 208
A 260 430 240
A 77 199 1863
A 3401 1826 1748
A 748 503 268
A 658 511 350
R 3
R 2
A 1199 1115 445
A 2922 5178 270
A 1537 5191 1363
A 1355 2803 1701
A 3380 1672 2512
A 1116 1314 5940
A 1324 1172 3952
A 287 545 501
A 3032 120 72
A 102 342 486
A 2234 3706...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 813 lines

Test #41:

score: 0
Accepted
time: 1ms
memory: 5968kb

input:

1099 699 1299
813
A 540 1070 560
A 1956 1029 208
A 260 430 240
A 77 199 1863
A 3401 1826 1748
A 748 503 268
A 658 511 350
R 3
R 2
A 1199 1115 445
A 2922 5178 270
A 1537 5191 1363
A 1355 2803 1701
A 3380 1672 2512
A 1116 1314 5940
A 1324 1172 3952
A 287 545 501
A 3032 120 72
A 102 342 486
A 2234 3706...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 813 lines

Test #42:

score: 0
Accepted
time: 1ms
memory: 6000kb

input:

501 1001 8497
813
A 540 1070 560
A 1956 1029 208
A 260 430 240
A 77 199 1863
A 3401 1826 1748
A 748 503 268
A 658 511 350
R 3
R 2
A 1199 1115 445
A 2922 5178 270
A 1537 5191 1363
A 1355 2803 1701
A 3380 1672 2512
A 1116 1314 5940
A 1324 1172 3952
A 287 545 501
A 3032 120 72
A 102 342 486
A 2234 3706...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 813 lines

Test #43:

score: 0
Accepted
time: 1ms
memory: 5976kb

input:

1 1 1
1000
A 117 987 202
A 221 2442 4001
R 1
A 3386 1562 528
A 1062 1492 5106
A 1531 154 380
A 4340 4155 0
A 994 3482 4505
A 343 1936 4556
A 2433 1301 0
A 1671 52 3445
R 5
A 109 309 183
R 3
A 16 2 28
A 719 848 0
A 2061 793 952
A 3265 733 3597
A 37 471 142
R 2
R 16
A 1729 784 318
A 1643 1270 5828
R 4...

output:

0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 1000 lines

Test #44:

score: 0
Accepted
time: 1ms
memory: 5928kb

input:

1 1 1
1000
A 117 987 202
A 221 2442 4001
A 3386 1562 528
A 1062 1492 5106
A 1531 154 380
A 4340 4155 0
A 994 3482 4505
A 343 1936 4556
A 2433 1301 0
A 1671 52 3445
R 5
A 109 309 183
R 3
A 16 2 28
A 719 848 0
A 2061 793 952
A 3265 733 3597
A 37 471 142
R 2
R 16
A 1729 784 318
A 1643 1270 5828
R 4
A 5...

output:

0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 1000 lines

Test #45:

score: 0
Accepted
time: 1ms
memory: 5928kb

input:

8 1 14
1000
A 117 987 202
A 221 2442 4001
A 3386 1562 528
A 1062 1492 5106
A 1531 154 380
A 4340 4155 0
A 994 3482 4505
A 343 1936 4556
A 2433 1301 0
A 1671 52 3445
R 5
A 109 309 183
R 3
A 16 2 28
A 719 848 0
A 2061 793 952
A 3265 733 3597
A 37 471 142
R 2
R 16
A 1729 784 318
A 1643 1270 5828
R 4
A ...

output:

0
0
0
0
0
0
0
0
0
3
3
3
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 1000 lines

Test #46:

score: 0
Accepted
time: 3ms
memory: 6072kb

input:

2557 2879 2592
3500
A 1595 1771 1540
A 2202 2352 2136
A 2826 2978 2670
A 1530 1726 1650
A 1699 1999 1877
A 1547 1745 1614
A 2802 3165 2730
A 2557 2879 2592
A 634 707 666
A 1721 1889 1742
A 2130 2400 2160
A 1613 1723 1570
A 2279 2553 2304
A 2040 2272 1932
A 1601 1831 1697
A 2911 3198 3034
R 12
R 10
A...

output:

0
0
0
0
3
3
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 3500 lines

Test #47:

score: 0
Accepted
time: 3ms
memory: 6104kb

input:

633 707 666
3500
A 1595 1771 1540
A 2202 2352 2136
A 2826 2978 2670
A 1530 1726 1650
A 1699 1999 1877
A 1547 1745 1614
A 2802 3165 2730
A 2557 2879 2592
A 634 707 666
A 1721 1889 1742
A 2130 2400 2160
A 1613 1723 1570
A 2279 2553 2304
A 2040 2272 1932
A 1601 1831 1697
A 2911 3198 3034
R 12
R 10
A 69...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 3500 lines

Test #48:

score: 0
Accepted
time: 2ms
memory: 5948kb

input:

12 13 15
2819
A 226 96 78
R 1
A 306 76 18
A 90 130 180
A 878 222 540
A 441 564 635
R 4
R 2
R 3
A 1603 1421 2016
A 42 142 216
A 1568 1330 2142
A 487 528 625
A 1218 420 3402
R 5
A 58 138 204
A 1131 24 485
R 6
R 7
R 8
A 1131 24 485
A 142 798 700
R 14
R 9
R 10
R 11
A 266 86 48
R 12
A 234 94 72
A 1358 78...

output:

0
0
0
0
0
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
0
0
0
0
0
3
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 2819 lines

Test #49:

score: 0
Accepted
time: 2ms
memory: 6012kb

input:

12 13 15
2891
A 1 2 3
A 2 3 4
A 3 4 5
A 4 5 6
A 5 6 7
A 6 7 8
A 7 8 9
A 8 9 10
A 9 10 11
A 10 11 12
A 12 13 14
A 13 14 15
A 226 96 78
R 1
A 306 76 18
A 90 130 180
A 878 222 540
A 441 564 635
R 4
R 2
R 3
A 1603 1421 2016
A 42 142 216
A 1568 1330 2142
A 487 528 625
A 1218 420 3402
R 5
A 58 138 204
A 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 2891 lines

Test #50:

score: 0
Accepted
time: 3ms
memory: 5996kb

input:

12 13 15
2891
A 1 2 3
A 3 3 4
A 3 4 5
A 4 5 6
A 5 6 7
A 6 7 8
A 7 8 9
A 8 9 10
A 9 10 11
A 10 11 12
A 12 13 14
A 13 14 15
A 226 96 78
R 1
A 306 76 18
A 90 130 180
A 878 222 540
A 441 564 635
R 4
R 2
R 3
A 1603 1421 2016
A 42 142 216
A 1568 1330 2142
A 487 528 625
A 1218 420 3402
R 5
A 58 138 204
A 1...

output:

0
0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 2891 lines

Test #51:

score: 0
Accepted
time: 5ms
memory: 6092kb

input:

2157 4011 1755
4997
A 2674 932 1675
A 417 2157 5350
A 606 1438 3237
A 2373 1438 1472
A 390 2158 5376
A 2156 4011 1755
A 2674 409 2198
A 143 1438 3702
A 4528 2157 1239
A 3189 1438 654
A 612 1438 3233
A 5287 2157 480
A 1586 1438 2259
A 2157 4010 1755
A 4764 2157 1001
A 150 1438 3695
A 5644 2157 123
A ...

output:

0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 4997 lines

Test #52:

score: 0
Accepted
time: 0ms
memory: 6328kb

input:

21 19 17
5000
A 326 1626 5002
A 5928 3174 132
R 2
A 5011 1124 3498
A 1627 5683 2323
A 2275 4810 2548
R 3
A 5587 348 3698
A 3148 2952 854
A 5778 3186 270
A 2982 2874 1098
A 4428 3294 1512
A 2328 3462 3444
A 1339 6071 2223
A 3283 3452 2898
R 7
R 12
A 4651 1609 3373
R 6
A 1322 2094 3538
A 5155 930 3548...

output:

0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 5000 lines

Test #53:

score: 0
Accepted
time: 4ms
memory: 6360kb

input:

7001 2001 998
5000
A 2001 7489 510
A 2001 7763 236
A 1729 7001 1270
A 2001 7606 393
A 2001 7545 454
R 3
A 2001 7040 959
A 1676 7001 1323
A 1945 7001 1054
A 1136 7001 1863
A 1747 7001 1252
A 1784 7001 1215
A 2001 7950 49
A 2001 7409 590
A 1133 7001 1866
R 1
A 2001 7947 52
A 1798 7001 1201
A 2001 7962...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 5000 lines

Test #54:

score: 0
Accepted
time: 4ms
memory: 6344kb

input:

2000 7941 56
5000
A 2001 7489 510
A 2001 7763 236
A 1729 7001 1270
A 2001 7606 393
A 2001 7545 454
R 3
A 2001 7040 959
A 1676 7001 1323
A 1945 7001 1054
A 1136 7001 1863
A 1747 7001 1252
A 1784 7001 1215
A 2001 7950 49
A 2001 7409 590
A 1133 7001 1866
R 1
A 2001 7947 52
A 1798 7001 1201
A 2001 7962 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 5000 lines

Test #55:

score: 0
Accepted
time: 3ms
memory: 8116kb

input:

1 4997 5001
5000
A 1 4996 5002
R 1
A 1 4995 5003
A 1 5000 4998
R 2
R 3
A 1 4996 5002
A 1 4999 4999
R 4
R 5
A 1 4995 5003
A 1 5000 4998
A 1 4992 5006
R 6
A 1 4996 5002
R 7
R 8
A 1 4993 5005
A 1 5002 4996
R 9
A 1 4999 4999
R 10
A 1 4995 5003
A 1 4994 5004
A 1 4992 5006
A 1 4996 5002
A 1 4995 5003
A 1 ...

output:

0
0
0
2
0
0
0
2
0
0
0
2
2
2
2
0
0
0
2
2
2
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 5000 lines

Test #56:

score: 0
Accepted
time: 0ms
memory: 8120kb

input:

1 4992 5006
5000
A 1 4996 5002
R 1
A 1 4995 5003
A 1 5000 4998
R 2
R 3
A 1 4996 5002
A 1 4999 4999
R 4
R 5
A 1 4995 5003
A 1 5000 4998
A 1 4992 5006
R 6
A 1 4996 5002
R 7
R 8
A 1 4993 5005
A 1 5002 4996
R 9
A 1 4999 4999
R 10
A 1 4995 5003
A 1 4994 5004
A 1 4992 5006
A 1 4996 5002
A 1 4995 5003
A 1 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 5000 lines

Subtask #4:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #57:

score: 40
Accepted
time: 4ms
memory: 8120kb

input:

1 1 1
6953
A 331109 339106 299121
A 330177 337242 301917
R 2
A 112682 142818 127750
A 112428 143072 127750
A 26205 26205 69333
A 122458 122458 67624
A 127230 128270 127750
A 112152 143348 127750
A 187878 178981 143393
A 324729 326346 318261
A 116940 138560 127750
R 9
R 3
A 179178 174631 156443
R 10
...

output:

0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 6953 lines

Test #58:

score: 0
Accepted
time: 0ms
memory: 6120kb

input:

112 143 127
6953
A 331109 339106 299121
A 330177 337242 301917
R 2
A 112682 142818 127750
A 112428 143072 127750
A 26205 26205 69333
A 122458 122458 67624
A 127230 128270 127750
A 112152 143348 127750
A 187878 178981 143393
A 324729 326346 318261
A 116940 138560 127750
R 9
R 3
A 179178 174631 156443...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 6953 lines

Test #59:

score: 0
Accepted
time: 5ms
memory: 8136kb

input:

112151 143348 127750
6953
A 331109 339106 299121
A 330177 337242 301917
R 2
A 112682 142818 127750
A 112428 143072 127750
A 26205 26205 69333
A 122458 122458 67624
A 127230 128270 127750
A 112152 143348 127750
A 187878 178981 143393
A 324729 326346 318261
A 116940 138560 127750
R 9
R 3
A 179178 1746...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 6953 lines

Test #60:

score: 0
Accepted
time: 4ms
memory: 6136kb

input:

112152 143348 127750
6953
A 331109 339106 299121
A 330177 337242 301917
R 2
A 112682 142818 127750
A 112428 143072 127750
A 26205 26205 69333
A 122458 122458 67624
A 127230 128270 127750
A 112152 143348 127750
A 187878 178981 143393
A 324729 326346 318261
A 116940 138560 127750
R 9
R 3
A 179178 1746...

output:

0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 6953 lines

Test #61:

score: 0
Accepted
time: 7ms
memory: 7456kb

input:

333331 333330 333331
20000
A 333332 333332 333333
A 333332 333330 333335
A 333334 333330 333333
A 333333 333329 333335
A 333334 333332 333333
A 333333 333329 333335
A 333335 333331 333333
R 1
A 333333 333329 333335
A 333334 333331 333332
A 333333 333330 333336
A 333332 333331 333334
A 333333 333331 ...

output:

0
0
0
0
3
3
3
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 20000 lines

Test #62:

score: 0
Accepted
time: 12ms
memory: 7472kb

input:

111113 111112 111110
20000
A 333332 333332 333333
A 333332 333330 333335
A 333334 333330 333333
A 333333 333329 333335
A 333334 333332 333333
A 333333 333329 333335
A 333335 333331 333333
R 1
A 333333 333329 333335
A 333334 333331 333332
A 333333 333330 333336
A 333332 333331 333334
A 333333 333331 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 20000 lines

Test #63:

score: 0
Accepted
time: 78ms
memory: 12440kb

input:

4 2 1
99999
A 137850 286018 93607
R 1
A 85004 182948 34707
A 91872 211147 53533
R 2
A 151502 287558 56197
A 240338 456656 109189
A 112472 197884 53441
R 3
A 157974 316448 61862
A 242066 513318 126847
A 111514 208768 80062
A 131298 247653 45592
R 9
A 216637 430340 88618
A 3962 23026 6374
R 12
A 20384...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 99999 lines

Test #64:

score: 0
Accepted
time: 84ms
memory: 12132kb

input:

6919 13857 1
99999
A 137850 286018 93607
R 1
A 85004 182948 34707
A 91872 211147 53533
R 2
A 151502 287558 56197
A 240338 456656 109189
A 112472 197884 53441
R 3
A 157974 316448 61862
A 242066 513318 126847
A 111514 208768 80062
A 131298 247653 45592
R 9
A 216637 430340 88618
A 3962 23026 6374
R 12
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
3
...

result:

ok 99999 lines

Test #65:

score: 0
Accepted
time: 74ms
memory: 9052kb

input:

192868 377342 275141
100000
A 131081 256227 186171
A 25834 48436 35707
A 70651 137878 103934
R 1
R 3
A 178715 355046 253536
R 4
A 87161 172040 118400
A 66309 130559 97189
A 4870 9324 7045
A 88480 172984 121801
A 161401 309849 213151
A 69459 134907 101489
R 2
A 65090 127906 92565
A 199580 374871 2624...

output:

0
0
0
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 100000 lines

Test #66:

score: 0
Accepted
time: 65ms
memory: 9044kb

input:

104777 203717 149348
100000
A 131081 256227 186171
A 25834 48436 35707
A 70651 137878 103934
R 1
R 3
A 178715 355046 253536
R 4
A 87161 172040 118400
A 66309 130559 97189
A 4870 9324 7045
A 88480 172984 121801
A 161401 309849 213151
A 69459 134907 101489
R 2
A 65090 127906 92565
A 199580 374871 2624...

output:

0
0
3
0
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 100000 lines

Test #67:

score: 0
Accepted
time: 1ms
memory: 7988kb

input:

99947 5 3
5
A 99989 1 1
A 99961 7 3
A 99962 7 3
A 99999 1 0
A 99923 1 5

output:

0
0
0
0
3

result:

ok 5 lines

Test #68:

score: 0
Accepted
time: 1ms
memory: 5964kb

input:

998544 15 10
10
A 999907 11 13
A 999931 17 11
A 999953 19 7
A 999959 13 11
A 999907 13 11
A 584402 4 2
R 1
A 414142 11 8
R 6
A 292201 2 1

output:

0
0
3
3
3
3
3
2
3
2

result:

ok 10 lines

Test #69:

score: 0
Accepted
time: 94ms
memory: 13096kb

input:

13 7 11
99722
A 344726 118283 254130
A 12141 486228 4961
A 21530 256062 261185
R 1
R 2
R 3
A 90445 450271 324899
R 4
A 26936 120041 21515
A 675612 49940 229373
A 48448 147754 251062
R 5
A 102380 190783 161667
A 637358 10396 7704
A 516963 34582 7592
A 6035 676022 79306
A 371784 81927 215749
A 172652 ...

output:

0
0
3
0
0
0
0
0
0
0
3
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 99722 lines

Test #70:

score: 0
Accepted
time: 72ms
memory: 11620kb

input:

272829 272830 272831
90001
A 7 182238 817701
A 2 258434 741503
A 104681 895236 2
A 49669 8 950300
A 774111 8 225798
A 141760 6 858169
R 2
A 131402 2 868541
A 5 652177 347773
A 615323 4 384643
A 548776 451162 4
R 1
A 42232 957677 7
A 882506 117394 2
A 613911 5 386042
R 4
R 3
A 6 941629 58343
R 10
A 7...

output:

0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 90001 lines

Test #71:

score: 0
Accepted
time: 76ms
memory: 11800kb

input:

272829 272830 272831
90001
A 7 182238 817701
A 2 258434 741503
A 104681 895236 2
A 49669 8 950300
A 774111 8 225798
A 141760 6 858169
A 1 1 1
A 131402 2 868541
A 5 652177 347773
A 615323 4 384643
A 548776 451162 4
A 172819 172830 172831
A 42232 957677 7
A 882506 117394 2
A 613911 5 386042
R 4
R 3
A ...

output:

0
0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 90001 lines

Test #72:

score: 0
Accepted
time: 75ms
memory: 12452kb

input:

41 47 43
99999
A 29069 33323 30487
A 150920 131102 131152
A 114106 101398 103874
A 320999 277767 290724
A 149099 129888 134187
A 275216 241948 247483
A 203271 177680 190471
R 3
A 317103 276837 285201
A 241748 210998 218629
A 298548 261734 274843
A 47371 45997 45623
A 241298 210548 219529
A 113110 98...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 99999 lines

Test #73:

score: 0
Accepted
time: 86ms
memory: 12444kb

input:

331421 290661 299635
99999
A 29069 33323 30487
A 150920 131102 131152
A 114106 101398 103874
A 320999 277767 290724
A 149099 129888 134187
A 275216 241948 247483
A 203271 177680 190471
R 3
A 317103 276837 285201
A 241748 210998 218629
A 298548 261734 274843
A 47371 45997 45623
A 241298 210548 219529...

output:

0
0
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 99999 lines