#include <bits/stdc++.h>
using namespace std;
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0;
    *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
void diophantine(long long a, long long b, long long c, long long *c1,
                 long long *c2) {
  long long x, y;
  long long d = gcdExtended(a, b, &x, &y);
  c = c / d;
  *c1 = x * c;
  *c2 = y * c;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n == 1 || n == 2 || n == 4)
      cout << -1 << endl;
    else if (n % 3 == 0)
      cout << n / 3 << " " << 0 << " " << 0 << endl;
    else if (n % 5 == 0)
      cout << 0 << " " << n / 5 << " " << 0 << endl;
    else if (n % 7 == 0)
      cout << 0 << " " << 0 << " " << n / 7 << endl;
    else {
      long long three = 0;
      long long five = 0;
      long long seven = 0;
      while (1) {
        n -= 3;
        three++;
        if (n % 5 == 0) {
          five = n / 5;
          break;
        }
        if (n % 7 == 0) {
          seven = n / 7;
          break;
        }
      }
      cout << three << " " << five << " " << seven << endl;
    }
  }
}
