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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;

public class ProblemE {
	
	
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		
		int T = Integer.valueOf(in.readLine());
		for (int i = 0 ; i < T ; i++) {
			long[] ans = solve(Long.valueOf(in.readLine()));
			if (ans == null) {
				out.println(-1);
			} else {
				out.println(ans[0] + " " + ans[1] + " " + ans[2] + " " + ans[3] + " " + ans[4] + " " + ans[5]);
			}
		}
		out.flush();
	}
	


	private static long[] solve(long v) {
		char[] c = new StringBuilder(String.valueOf(v)).reverse().toString().toCharArray();
		int l = c.length;
		boolean[][][] dp = new boolean[l+1][7][5];
		int[][][][] taken = new int[l+1][7][5][4];
		
		for (int i = 0 ; i < 7 ; i++) {
			dp[0][i][0] = true;
		}
		for (int i = 0 ; i < l ; i++) {
			for (int live = 0 ; live < 7 ; live++) {
				for (int up = 0 ; up < 5 ; up++) {
					if (!dp[i][live][up]) {
						continue;
					}
					for (int four = 0 ; four <= live ; four++) {
						for (int seven = 0 ; four + seven <= live ; seven++) {
							int digit = four * 4 + seven * 7 + up;
							if (digit % 10 != c[i] - '0') {
								continue;
							}
							int nd = digit/10;
							for (int tl = (live - four - seven) ; tl <= live ; tl++) {
								dp[i+1][tl][nd] = true; 
								taken[i+1][tl][nd][0] = four;
								taken[i+1][tl][nd][1] = seven;
								taken[i+1][tl][nd][2] = live;
								taken[i+1][tl][nd][3] = up;
							}
						}
					}
				}
			}
		}
		
		for (int live = 0 ; live < 7 ; live++) {
			for (int up = 0 ; up <= 0 ; up++) {
				if (dp[l][live][up]) {
					long[] res = new long[6];
					for (int i = l ; i >= 1 ; i--) {
						int f = taken[i][live][up][0];
						int s = taken[i][live][up][1];
						int nlive = taken[i][live][up][2];
						int nup = taken[i][live][up][3];
						long base = (long)Math.pow(10L, i-1);
						for (int j = 0 ; j < f ; j++) {
							res[j] += base * 4;
						}
						for (int j = f ; j < f + s ; j++) {
							res[j] += base * 7;							
						}
						live = nlive;
						up = nup;
					}
					return res;
				}
			}
		}
		return null;
	}



	public static void debug(Object... o) {
		System.err.println(Arrays.deepToString(o));
	}
}