#include <bits/stdc++.h>
const int mod = 1e9 + 7;
using namespace std;
priority_queue<pair<int, int>> qx;
priority_queue<int> qx1;
priority_queue<int, vector<int>, greater<int>> qx2;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
inline long long lread() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
long long mypow(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool isSquare(int x) {
  int y = sqrt(x);
  return y * y == x;
}
const int maxn = 1e6 + 10;
int t, m, n;
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int a = n / 3;
    int b = n / 5;
    int c = n / 7;
    int f = 0;
    for (int i = 0; i <= a; i++) {
      for (int j = 0; j <= b; j++) {
        for (int k = 0; k <= c; k++) {
          if (i * 3 + j * 5 + k * 7 == n) {
            f = 1;
            printf("%d %d %d\n", i, j, k);
          }
        }
        if (f) break;
      }
      if (f) break;
    }
    if (f == 0) printf("-1\n");
  }
}
