Codeforces Round 720 (Div. 2)


A. Nastia and Nearly Good Numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 3
13 2
7 11
Output
YES
10 50 60
YES
169 39 208
YES
28 154 182
----------------------------------------------------------------------------------------------------
B. Nastia and a Good Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
9 6 3 11 15
3
7 5 13
Output
2
1 5 11 9
2 5 7 6
0
----------------------------------------------------------------------------------------------------
C. Nastia and a Hidden Permutation
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4
3
2
5
3
Output
? 2 4 1 3
? 1 2 4 2
! 3 1 4 2
? 2 3 4 2
! 2 5 3 4 1
----------------------------------------------------------------------------------------------------
D. Nastia Plays with a Tree
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
7
1 2
1 3
2 4
2 5
3 6
3 7
4
1 2
1 3
3 4
Output
2
2 5 6 7
3 6 4 5
0
----------------------------------------------------------------------------------------------------
E. Nastia and a Beautiful Matrix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3 4
2 0 0 1
15 4
2 4 8 1
Output
2
4 1
0 1
5
3 0 0 2 2
3 2 3 3 0
0 1 0 4 0
3 0 0 0 0
2 1 3 3 3
----------------------------------------------------------------------------------------------------
