#include <bits/stdc++.h>
const long long int mod = 1000000007;
const long long int MAX = 8000000000000000064LL;
const long long int MIN = -8000000000000000064LL;
long long int add(long long int x, long long int y) {
  long long int res = x + y;
  return (res >= mod ? res - mod : res);
}
long long int mul(long long int x, long long int y) {
  long long int res = x * y;
  return (res >= mod ? res % mod : res);
}
long long int sub(long long int x, long long int y) {
  long long int res = x - y;
  return (res < 0 ? res + mod : res);
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x %= mod;
  while (y) {
    if (y & 1) res = mul(res, x);
    y >>= 1;
    x = mul(x, x);
  }
  return res;
}
long long int mod_inv(long long int x) { return power(x, mod - 2); }
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int x, long long int y) {
  long long int res = x / gcd(x, y);
  return (res * y);
}
using namespace std;
bool isprime(long long int n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0 and n != 2) return false;
  for (long long int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
bool isPowerOfTwo(long long int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  cin >> tc;
  while (tc--) {
    long long int n;
    cin >> n;
    if (n == 1 || n == 2 || n == 4) {
      cout << -1 << "\n";
    } else if (n % 3 == 0) {
      cout << n / 3 << " " << 0 << " " << 0 << "\n";
    } else if (n % 3 == 1) {
      cout << (n - 7) / 3 << " " << 0 << " " << 1 << "\n";
    } else {
      cout << (n - 5) / 3 << " " << 1 << " " << 0 << "\n";
    }
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}
