Under construction

Still being built. Things may change

Degrees, radians, gradians

Time limit1sMemory limit512 MB

Summary
Given an angle written with six decimals in degrees, radians, or gradians, recover the integer degree value and the unit, or report that it is ambiguous.
Level

Medium6 of 10

Topics
Math, Implementation, Brute force, Number theory
Solved
No attempts yet

Problem

In math class, Alice thought of an angle measured by an integer nn degrees (from 0 to 359) and passed Bob the value of the angle written in one of three common units: degrees, radians, or gradians (a metric unit of angle measurement; a right angle contains 100 gradians). The notation has exactly 6 digits after the decimal point and differs from the exact value by less than 5⋅10−75 \cdot 10^{-7}.

Bob asked you to help recover the value of nn and to determine which units Alice used for the notation.

Input

The first line of the input contains a single integer TT, the number of test cases (1≤T≤201 \le T \le 20). Each of the following TT lines contains a single real number written with exactly 6 digits after the decimal point: the result of Alice's calculation.

It is guaranteed that the numbers were obtained in the manner described in the problem statement.

Output

If the value of nn and the units used cannot be recovered uniquely, output −1-1. Otherwise output two integers: the original value nn and the type of units, where 11 is degrees, 22 is radians, and 33 is gradians.

Hint

In the first example, Bob can recover n=0n=0, but he cannot get any information about the units, so the answer is −1-1.

Examples1

  1. Example 1

    Input
    3
    0.000000
    3.141593
    1.111111
    
    Expected output
    -1
    180 2
    1 3