Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Elementary Math

Limits 1s, 512 MB · Custom Checker

Ellen is teaching elementary math to her students and the time for the final exam has come. The exam consists of n questions. In each question the students have to add (+), subtract (-) or multiply (*) a pair of numbers.

Ellen has already chosen then pairs of numbers. All that remains is to decide for each pair which of the three possible operations the students should perform. To avoid students getting bored, Ellen wants to make sure that then correct answers to her exam are all different.Please help Ellen finish constructing the exam by automating this task.

Input

The input consists of:

  • one line with one integer n (1 ≤ n ≤ 2500), the number of pairs of numbers;

  • n lines each with two integers a and b (-106 ≤ a, b ≤ 106), a pair of numbers used.

Output

For each pair of numbers (a, b) in the same order as in the input, output a line containing a valid equation. Each equation should consist of five parts:a, one of the three operators,b, an equals sign (=), and the result of the expression. All then expression results must be different.

If there are multiple valid answers you may output any of them. If there is no valid answer,output a single line with the string “impossible” instead.

Samples

InputOutput
4
1 5
3 3
4 5
-1 -6
1 + 5 = 6
3 * 3 = 9
4 - 5 = -1
-1 - -6 = 5
InputOutput
4
-4 2
-4 2
-4 2
-4 2
impossible

This NWERC 2015 problem is licensed under the CC BY-SA 3.0 license.

You can find the original problem on the NWERC website.


    Discussion
    Statistics

    50% Solution Ratio

    emrul_mu Earliest, 5d ago

    emrul_mu Fastest, 0.0s

    emrul_mu Lightest, 262 kB

    emrul_mu Shortest, 1046B

    Submit

    Login to submit