#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void sample() {}
long long int* read(long long int n) {
  long long int* arr = new long long int[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  return arr;
}
void solve() {
  long long int n, i, j, k, ans, m, o;
  cin >> n;
  long long int c3 = 0, c5 = 0, c7 = 0;
  if (n < 3) {
    cout << -1 << endl;
    return;
  }
  if (n >= 10) {
    long long int rem = n % 5;
    n = n - rem;
    c5 = n / 5;
    if (rem == 0) {
      cout << c3 << " " << c5 << " " << c7 << endl;
      return;
    }
    if (rem == 1) {
      c5--;
      c3 += 2;
      cout << c3 << " " << c5 << " " << c7 << endl;
      return;
    }
    if (rem == 2) {
      c7 = 1;
      c5--;
      cout << c3 << " " << c5 << " " << c7 << endl;
      return;
    }
    if (rem == 3) {
      c7 = 0;
      c3 = 1;
      cout << c3 << " " << c5 << " " << c7 << endl;
      return;
    }
    if (rem == 4) {
      c7 = 2;
      c5--;
      c5--;
      cout << c3 << " " << c5 << " " << c7 << endl;
      return;
    }
    cout << -1 << endl;
  }
  if (n == 3) {
    cout << "1 0 0" << endl;
    return;
  }
  if (n == 5) {
    cout << "0 1 0" << endl;
    return;
  }
  if (n == 6) {
    cout << "2 0 0" << endl;
    return;
  }
  if (n == 7) {
    cout << "0 0 1" << endl;
    return;
  }
  if (n == 8) {
    cout << "1 1 0" << endl;
    return;
  }
  if (n == 9) {
    cout << "3 0 0" << endl;
    return;
  }
  if (n == 4) {
    cout << -1 << endl;
    return;
  }
  return;
}
int main() {
  fast();
  sample();
  long long int i, j, k, n, m, a, b, c, d, p, q, r, l, t = 1;
  long long int sum, count = 0, ans = 0;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
