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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void read(int& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
int T, i, j, k, l, p, w;
char a[20];
long long ans[10], ten[20];
bool v[20][20];
bool dfs(int i, int j) {
  if (j >= 5) return 0;
  if (i == w + 1) return j == 0;
  if (v[i][j]) return 0;
  v[i][j] = 1;
  int t, s0, s1, last = j * 10 + a[i] - '0';
  for (s0 = 0; s0 <= 6; s0++)
    for (s1 = 0; s1 <= 6 - s0; s1++)
      if (s0 * 4 + s1 * 7 <= last)
        if (dfs(i + 1, last - (s0 * 4 + s1 * 7))) {
          for (t = 1; t <= s0; t++) ans[t] += ten[w - i] * 4;
          for (t = 1; t <= s1; t++) ans[t + s0] += ten[w - i] * 7;
          return 1;
        }
  return 0;
}
int main() {
  for (read(T); T; T--) {
    scanf("%s", a + 1);
    w = strlen(a + 1);
    memset(ans, 0, sizeof(ans));
    memset(v, 0, sizeof(v));
    ten[0] = 1;
    for (i = 1; i <= w; i++) ten[i] = ten[i - 1] * 10;
    if (dfs(1, 0)) {
      for (i = 1; i <= 6; i++) printf("%I64d%s", ans[i], i == 6 ? "\n" : " ");
    } else
      printf("-1\n");
  }
  scanf("\n");
  return 0;
}