ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

2237. Home, Sweet Home

Time limit: 1.0 second
Memory limit: 256 MB
Vadim is playing a niche game. This game has a side view, and everything takes place on an almost infinite rectangular grid of cells. You can place no more than one block in each cell. Vadim wants to build a wooden house for himself using the following algorithm:
  1. First, he chooses the width and height of the house (below are examples for 7 × 4 and 6 × 4). The width and height are at least 3.
  2. Then he builds a “box” of blocks — a rectangular frame of wooden blocks (in the diagram, wooden blocks are denoted by the # symbol).
    ####### ######
    #↑↑↑↑↑# #↑↑↑↑#
    ## ##
    ####### ######
  3. After that, he goes inside and demolishes all the “ceiling” blocks; these blocks are returned to him completely intact (in the previous diagram, they are indicated by the ↑ symbols).
    ## ##
    ## ##
    ## ##
    ####### ######
  4. Then he goes out of the house and builds a roof from the bottom up and towards the center out of wooden “stairs”, since they can be oriented in both directions (in the diagram below, wooden stairs are denoted by the symbols / and \).
  5. If at the end he has to place a left stair and a right stair in the same cell, he instead places a wooden “slab” (in the diagram below, the wooden slab is denoted by the – symbol).
    -
    /○\ /\
    /○○○\ /○○\
    /○○○○○\ /○○○○\
    /#○○○○○#\ /#○○○○#\
    #○○○○○# #○○○○#
    #○○○○○# #○○○○#
    ####### ######
  6. At the very end, Vadim evaluates his work: he counts the number of empty cells inside the house (in the diagram above, these cells are denoted by the ∘ symbol). Vadim calls this number the “volume”.
As every player knows, you cannot just get stairs and slabs for free: they need to be crafted. To craft four stairs, six wooden blocks are used, and to craft six half-blocks, three wooden blocks are used:
#        
# #   → / or \ (4 stairs)
# # #    
         
# # # → - (6 slabs)
Vadim has T worlds, in each of which he has Ni wooden blocks. In each world, he wants to build a house with the maximum volume out of the blocks. Help him find these volumes ant the sizes of the houses at which these volumes are achieved.

Input

The first line of input contains an integer T — the number of worlds (1 ≤ T ≤ 1 000).
The next T lines of input contain integers Ni — the number of wooden blocks Vadim has in the i-th world (16 ≤ Ni ≤ 109).

Output

For each world, output three integers — the maximum possible volume of the house, and the width and height of a house at which this volume is achieved. It is guaranteed that an answer exists. If there are several answers, output any of them.

Sample

inputoutput
2
20
30
6
4 3
30
6 7
Problem Author: Vadim Barinov
Problem Source: The 2026 ICPC UrFU Qualification