#include <bits/stdc++.h>
using namespace std;
template <typename X>
inline X sqr(const X& a) {
  return a * a;
}
int nxt() {
  int x;
  cin >> x;
  return x;
}
void solve() {
  int n = nxt();
  if (n == 1 || n == 2 || n == 4) {
    cout << -1 << '\n';
    return;
  }
  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';
  }
}
int main() {
  int t = nxt();
  while (t--) {
    solve();
  }
  return 0;
}
