#include <bits/stdc++.h>
using namespace std;
const char newl = '\n';
void DEBUGLOCAL() { cerr << ")" << newl; }
template <class A, class... B>
void DEBUGLOCAL(A argc, B... argv) {
  cerr << argc;
  if (sizeof...(argv)) cerr << ", ";
  DEBUGLOCAL(argv...);
}
int ts;
int n;
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      for (int k = 0; k < n; ++k) {
        if (i * 3 + j * 5 + k * 7 == n) {
          cout << i << ' ' << j << ' ' << k << newl;
          return;
        }
      }
  cout << -1 << newl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> ts;
  while (ts--) solve();
}
