FINDTRI - Find Right Triangle

no tags 

Given natural number N you have to find a right triangle let the lengths of its sides are a, b, c.

This right triangle must satisfy:

  • a, b, c are positive integers.
  • a < b < c.
  • c - b = 1.
  • a = N.

Input

The first fine of input file has one integer T (1 <= T <= 105) the number of test cases.

T lines follow, each consisting of one integer N (1 <= N <= 109)

Output

if there is such right triangle then output its side lengths a, b, c respectively otherwise output -1.

Example

Input:
3
3
4
5

Output:
3 4 5
-1
5 12 13

hide comments
abdou_93: 2013-05-09 21:37:27

Please check my solution
... what is What's wrong ..id>>(9231884)

RE: your program fails with some tricky cases

<< Is the error in formula

Last edit: 2013-05-09 21:51:06
(Tjandra Satria Gunawan)(曾毅昆): 2013-05-01 15:17:12

too easy using math algebra... O(1) solution exists, imho this problem belong to tutorial.
moreover, I already discover this problem and the solution when I was in elementary school..

RE: you may let the others think of solution instead of publishing it

Last edit: 2013-05-01 15:52:48

Added by:Hasan Jaddouh
Date:2013-05-01
Time limit:1.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:own problem