Problem: We know that lucky digits are digits 4 and 7, however Vasya's got another favorite digit 0 and he assumes it also is lucky! Lucky numbers are such non-negative integers whose decimal record only contains lucky digits. For example, numbers 0, 47, 7074 are lucky, but 1, 7377, 895,  -7 are not.

Vasya has t important positive integers he needs to remember. Vasya is quite superstitious and he wants to remember lucky numbers only, so he is asking you for each important number to represent it as a sum of exactly six lucky numbers (Vasya just can't remember more numbers). Then Vasya can just remember these six numbers and calculate the important number at any moment.

For each of t important integers represent it as the sum of six lucky numbers or state that this is impossible.

Input

The first line contains a single integer t (1 ≤ t ≤ 5000).

Next t lines contain a single positive integer ni (1 ≤ ni ≤ 1018) — the list of important numbers.

Please, do not use the %lld to read or write 64-bit integers С++. It is preferred to read the cin, cout streams or the %I64d specifier.

Output

Print t lines. The i-th line must contain the answer for the i-th important number: if the solution exists, the line must contain exactly six lucky numbers the sum of which equals ni, if the solution doesn't exist the string must contain a single integer -1.

If there are multiple answers print any of them.

Examples

Input

5
42
17
444
7
51


Output

7 7 7 7 7 7
-1
400 0 40 0 4 0
7 0 0 0 0 0
47 4 0 0 0 0

Solution (in JAVA):

Solution:
import java.util.*;
public class e {
    static int[] digits;
    static String[] map;
public static void main(String[] args)
{
    map = new String[43];
    Arrays.fill(map, "");
    for(int i = 0; i<3*3*3*3*3*3; i++)
    {
        int temp = i;
        int[] data = new int[6];
        int sum = 0;
        for(int j = 0; j<6; j++)
        {
            data[j] = temp%3;
            if(data[j] == 1) data[j] = 4;
            else if(data[j] == 2) data[j] = 7;
            sum += data[j];
            temp /= 3;
        }
        if(map[sum].equals("")) map[sum] = string(data);
    }
    Scanner input = new Scanner(System.in);
    int T = input.nextInt();
    for(int t =0; t<T; t++)
    {
        long n = input.nextLong();
        digits = new int[19];
        for(int i = 0; i<19; i++)
        {
            digits[i] = (int)(n%10);
            n /= 10;
        }
        memo = new int[19][15];
        sums = new int[19][15];
        answers = new int[19][15][6];
        for(int[] A: memo) Arrays.fill(A, -1);
        for(int[] A: sums) Arrays.fill(A, -1);
        for(int[][] A: answers) for(int[] B: A) Arrays.fill(B, -1);
        int res = go(0, 0);
        //System.out.println(res);
        if(res==1)
        {
            output = new int[6][19];
            traceback(0, 0);
            long[] ans = new long[6];
            for(int i = 18; i>=0; i--)
                for(int j = 0; j<6; j++)
                {
                    ans[j] *= 10;
                    ans[j] += output[j][i];
                }
            for(int i = 0; i<6; i++) System.out.print(ans[i]+" ");
            System.out.println();
        }
        else System.out.println(-1);
        
    }
}
static int[][] output;
static int[][][] answers;
static int[][] sums;
static int[][] memo;
static int go(int place, int carry)
{
    if(place == 19) return carry == 0 ? 1 : 0;
    if(memo[place][carry] != -1) return memo[place][carry];
    int res = 0;
    for(int i = 0; i<43; i++)
    {
        if(map[i].equals("")) continue;
        int total = i + carry;
        if(total%10 != digits[place] || go(place+1, total/10) == 0) continue;
        res = 1;
        sums[place][carry] = i;
        for(int j = 0; j<6; j++) answers[place][carry][j] = map[i].charAt(j) - '0';
        break;
    }
    return memo[place][carry] = res;
}
static void traceback(int place, int carry)
{
    if(place==19) return;
    int sum = sums[place][carry];
    for(int i = 0; i<6; i++) output[i][place] = answers[place][carry][i];
    traceback(place+1, (carry+sum)/10);
}
static String string(int[] a)
{
    String res = "";
    for(int i =0; i<a.length; i++) res += a[i];
    return res;
}
}