Contest problemset description


Wide Addition
(W)
Memory limit: 1024 MB
Time limit: 1.00 s

Add two numbers given as input.

Input

The input consists of two integers N and M.

Output

Output a single integer equal to the sum of N and M.

Limits

 − 2 ⋅ 109 ≤ N, M ≤ 2 ⋅ 109.

Examples

Input Output
10 0
10
Input Output
-4 -9
-13

 


Xperimental Baking
(X)
Memory limit: 1024 MB
Time limit: 1.00 s

This task is interactive. After printing each line, you should flush the output buffer. You can use cout << flush in C++, System.out.flush() in Java, and sys.stdout.flush() in Python. You must strictly follow the instructions in the Interaction section; otherwise you may receive verdicts like wrong answer, time limit exceeded, or others.


Dwarf the Cook is planning to bake a cake today. Unfortunately, he has forgotten the most important part of the recipe: the amount of flour he needs to add to the dough! Now there is only one way to find it: he has to determine it experimentally!

He remembers that the number of grams of flour needed for the cake is an integer between 1 and N. He also knows that if he adds too much flour, the cake will turn out dry and hard, and if he adds too little, it will be wet and doughy. He has calculated that his remaining ingredients allow him to make at most 30 baking attempts.

Can you help him figure out how much flour to use in each attempt?

Interaction

First, read a single integer N.

Then, to try baking the cake with k grams of flour (where 1 ≤ k ≤ N), print this value in a single line and read a single character from the input. If the character is >, the cake turned out too wet; if it is <, the cake turned out too dry. If the character is =, the cake is perfect and your program should terminate.

You cannot make more than 30 baking attempts.

Limits

1 ≤ N ≤ 109.

Example interaction

In this example, N = 10 and the desired amount of flour is 7.

Input Output
10
5
>
8
<
7
=

Local testing

In the section Files you can find X.zip containing sample tests and grader. To test your solution, compile it, then pass the test name and your executable to ./grader:

./grader [test] [executable]

For example: ./grader 0a.in ./abc

Before the first run, you may need to make grader executable. This can be done using the command:

chmod +x grader

The sample grader is not guaranteed to behave identically to the official one. However, neither is adaptive.


Yummy Cakes
(Y)
Memory limit: 1024 MB
Time limit: 1.00 s

Dwarf the Sweet Tooth is preparing for a journey and needs to pack exactly S cakes (for an S-day adventure, because one cake a day keeps the doctor away). In his cellar, he has N boxes, each containing a different number of cakes: the first box contains 1 cake, the second contains 2 cakes, and so on, with the N-th box containing N cakes. However, he wants to open exactly K boxes (and take all the cakes from them, of course). Help him decide which boxes to open!

Input

The first line of input contains a single integer T, the number of test cases. Each test case is a single line containing three integers N, S, and K.

Output

For each test case, output a single line containing YES if it is possible to select exactly K boxes that together contain exactly S cakes, and NO otherwise. If the answer is YES, follow this with a second line containing a string of N digits, where the i-th digit is 1 if the Dwarf should open the i-th box, and 0 otherwise.

If there are multiple valid answers, you may print any of them.

Limits

1 ≤ T ≤ 8 000,
1 ≤ K ≤ N ≤ 40 000,
0 ≤ S ≤ 109.

Example

Input Output
3
3 6 2
5 7 3
1 1 1
NO
YES
11010
YES
1

 


Zigzagging Dwarf Trains
(Z)
Memory limit: 1024 MB
Time limit: 1.00 s

Dwarf the Dispatcher is in charge of organizing rat-pulled trains supplying the underground dwarf city. Each train consists of different types of carriages carrying different types of goods. Carriage types are denoted by single lowercase letters from the English alphabet. There are N trains to be organized according to a given plan, and all trains have equal length L (rats are smart and refuse to pull trains longer than others). The trains are initially stationed on N sidetracks, one train per track.

The Dispatcher can detach a carriage from the end of any train and attach it to the end of any other train. However, all sidetracks have limited length M, so each train can have at most M carriages during the rearrangement. Help the dwarf rearrange the trains: given the initial and target configurations, determine whether it is possible to rearrange the trains without exceeding the maximum length.

Input

The first line of input contains three positive integers N, M, and L: the number of trains, the maximum length of a train during the rearrangement, and the (initial and final) length of all trains, respectively.

The next N lines describe the initial train configurations, one per line. Each line contains a string of L lowercase English letters describing the carriage types in the train from beginning to end.

The next N lines describe the target train configurations in the same format.

Output

In the first line, print YES if it is possible to achieve the target configuration, or NO otherwise.

If the answer is YES, in the next line print S being the number of steps needed to achieve the target configuration. Each of the following S lines should contain two positive integers a and b, indicating that a carriage is moved from the end of train a to the end of train b. It is not necessary to minimize S, but it must not exceed 106.

Limits

1 ≤ N ≤ 100,
1 ≤ L ≤ M ≤ 100,
N ⋅ L ≤ 100.

Examples

Input Output
3 3 1
a
b
c
c
a
b
YES
5
1 2
3 1
2 1
2 3
1 2
Input Output
3 5 3
abc
dee
fff
cbe
dff
fae
YES
17
1 2
1 3
1 3
2 1
3 1
1 2
3 1
2 1
1 3
2 1
3 1
2 1
3 2
3 2
1 2
1 3
2 3
Input Output
2 3 2
aa
bc
aa
cb
NO