#include <bits/stdc++.h>
template <typename X>
inline X abs(const X& a) {
  return a < 0 ? -a : a;
}
template <typename X>
inline X sqr(const X& a) {
  return a * a;
}
using namespace std;
const int INF = 1000 * 1000 * 1000;
const long double EPS = 1e-9;
const long double PI = acos(-1.0);
long long n;
inline void read() { cin >> n; }
inline void solve() {
  if (n == 1 || n == 2 || n == 4) {
    cout << -1 << endl;
    return;
  }
  if (n % 3 == 0) {
    cout << n / 3 << ' ' << 0 << ' ' << 0 << endl;
  } else if (n % 3 == 1) {
    cout << (n - 7) / 3 << ' ' << 0 << ' ' << 1 << endl;
  } else {
    cout << (n - 5) / 3 << ' ' << 1 << ' ' << 0 << endl;
  }
}
int main() {
  cerr << setprecision(10) << fixed;
  int t;
  cin >> t;
  while (t--) {
    read();
    solve();
  }
}
