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


A. Spit Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0 1
1 -1
Output
YES
Input
3
0 1
1 1
2 -2
Output
NO
Input
5
2 -10
3 10
0 5
5 -5
10 1
Output
YES
----------------------------------------------------------------------------------------------------
B. Traffic Lights
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1 3 4 5
Output
0.66666667
Input
5 4 3 1 1
Output
2.33333333
----------------------------------------------------------------------------------------------------
C. Mail Stamps
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 100
100 2
Output
2 100 1 
Input
3
3 1
100 2
3 2
Output
100 2 3 1 
----------------------------------------------------------------------------------------------------
D. Ant on the Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
2 3
3
Output
1 2 3 2 1 
Input
6
1 2
1 3
2 4
4 5
4 6
5 6 3
Output
1 2 4 5 4 6 4 2 1 3 1 
Input
6
1 2
1 3
2 4
4 5
4 6
5 3 6
Output
-1
----------------------------------------------------------------------------------------------------
E. Quarrel
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
1 2
Output
1
1 2 
2 1 
Input
7 5
1 2
2 7
7 6
2 3
3 4
Output
-1
Input
7 6
1 2
2 7
7 6
2 3
3 4
1 5
Output
6
1 2 3 4 3 2 7 
7 6 7 2 1 5 1 
----------------------------------------------------------------------------------------------------
