This page is still under construction.

Parts of this page are still being built. What you see may change.

Maximum Multiple

Time limit2sMemory limit256 MB

Summary
For each n, split it into three positive divisors x, y, z summing to n so that the product xyz is as large as possible, or report that no split exists.
Level

Medium6 of 10

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

Problem

Given an integer nn, Chiaki would like to find three positive integers xx, yy and zz such that: n=x+y+zn=x+y+z, x∣nx\mid n, y∣ny \mid n, z∣nz \mid n and xyzxyz is maximum.

Input

There are multiple test cases. The first line of input contains an integer TT (1≤T≤1061 \le T \le 10^6), indicating the number of test cases. For each test case:

The first line contains an integer nn (1≤n≤1061 \le n \le 10^{6}).

Output

For each test case, output an integer denoting the maximum xyzxyz. If there no such integers, output −1-1 instead.

Examples1

  1. Example 1

    Input
    3
    1
    2
    3
    
    Expected output
    -1
    -1
    1