#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  ;
  if (n == 1 || n == 2 || n == 4) {
    cout << -1 << "\n";
    return;
  }
  if (n % 3 == 0) {
    cout << n / 3 << " ";
    cout << 0 << " ";
    cout << 0 << "\n";
  } else if ((n - 5) % 3 == 0) {
    cout << (n - 5) / 3 << " ";
    cout << 1 << " ";
    cout << 0 << "\n";
  } else if ((n - 7) % 3 == 0) {
    cout << (n - 7) / 3 << " ";
    cout << 0 << " ";
    cout << 1 << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
