Cargo Spaceship Loading

No attempts yetTime limit1sMemory limit256 MB

Problem

Juliet is reading a science fiction novel. In one chapter the main character has to get the most out of a cargo spaceship's capacity. The cargo consists of items shaped like a DD-dimensional mesh whose size is 3 nodes along every dimension. Each node of the mesh holds one ball, and all balls weigh the same. The connections between balls are so light that their weight is negligible next to the weight of a ball, so the weight of an item is decided only by the number of its nodes. The value of an item is the number of nodes plus the number of connections.

A DD-dimensional item has 3D3^D nodes, and there is one connection between every two nodes that are neighbours along a single axis.

DimensionWeightValue
zero dimension11
first dimension35
second dimension921

A spaceship has a limit on the weight it can carry. Load items so that the total weight stays within the limit and the total value is as large as possible. The supply of items is unlimited for every dimension. Exactly one loading reaches the largest total value.

Input

The first line contains the number of test cases NN. NN is a positive integer.

Each of the next NN lines contains one integer KK, the cargo capacity of the ship. (1K<1071 \le K < 10^7)

Output

For each test case, print Xm Xm1  X1 X0X_m\ X_{m-1}\ \dots\ X_1\ X_0 on one line, separated by single spaces. XiX_i is the number of items of dimension ii to load for the largest total value, and the count of the highest dimension, XmX_m, is greater than 0.