Codeforces Beta Round 31 (Div. 2, Codeforces format)


A. Worms Evolution
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 5 7
Output
3 2 1
Input
5
1 8 1 5 1
Output
-1
----------------------------------------------------------------------------------------------------
B. Sysadmin Bob
time limit per test: 0.5 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
a@aa@a
Output
a@a,a@a
Input
a@a@a
Output
No solution
Input
@aa@a
Output
No solution
----------------------------------------------------------------------------------------------------
C. Schedule
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 10
20 30
1 3
Output
3
1 2 3 
Input
4
3 10
20 30
1 3
1 39
Output
1
4 
Input
3
1 5
2 6
3 7
Output
0
----------------------------------------------------------------------------------------------------
D. Chocolate
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 2
1 0 1 2
0 1 1 1
Output
1 1 2 
Input
2 2 3
1 0 1 2
0 1 1 1
1 1 2 1
Output
1 1 1 1 
Input
2 4 2
0 1 2 1
0 3 2 3
Output
2 2 4 
----------------------------------------------------------------------------------------------------
E. TV Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1234
Output
HHMM
Input
2
9911
Output
HMHM
----------------------------------------------------------------------------------------------------
