NAJBB - Boss Baby

Boss Baby is the boss of all babies. He has been exploring prime numbers lately, and new recently made a conjecture resembling one of Goldbach's conjectures. Boss baby’s conjecture is that any number greater than or equal 10 can be expressed as the sum of a prime, square of two prime. It’s very easy work for him but he is busy to stop the dastardly plot of the CEO of Puppy Co.  He wants your help verify his conjecture for small numbers.

Note: 1 is not a prime number.

Input

The first line of the input contains an integer T (T ≤ 106) denoting the number of test cases. Each test case will consist of a number greater than 10 and less than 106, one per line.

Output

For each case, print the case number and the 3 primes P1, P2, P3 on a line, where P1 + P22 + P32 is equal to the number from the input. (P1, P2, P3 must be printed in sort order.) If no such primes exist, print "0 0 0" instead (quotes for clarity). If there are multiple triplets of primes that satisfy the equation, print the least one in sorted order.

Sample

Input:
3
18
20
23

Output:
Case 1: 2 3 5
Case 2: 2 3 3
Case 3: 3 3 5

Note

For second Case 20

  • 2, 3, 3 (2 + 32 + 32) = 20
  • 2, 3, 7 (22 + 32 + 7) = 20
are possible, but 2, 3, 3 is the least one


Added by:Najmuzzaman
Date:2017-05-06
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL LISP clisp D ERL HASK JAVA OCAML PAS-GPC PAS-FPC PERL PHP PICO PIKE PYTHON PYPY PYTHON3 RUBY

hide comments
2017-05-06 20:19:29
it's showing wrong problem when i submit.. why ?
2017-05-06 17:08:51 Najmuzzaman
no you must print it sort order. 5 2 3 is the ans but you print it sort order.

Last edit: 2017-05-06 17:10:40
2017-05-06 17:04:40
Explanation for case 1????
2 + 3*3 + 5*5 == 20???or is it 5 2 3???
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.