#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
void inputoutput() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
void solve() {
  int n;
  cin >> n;
  if (n == 1 || n == 2 || n == 4) {
    cout << "-1\n";
    return;
  }
  if (n % 3 == 0) {
    cout << n / 3 << " 0 0\n";
    return;
  } else if (n % 3 == 1) {
    cout << (n - 7) / 3 << " 0 "
         << "1 \n";
  } else {
    cout << (n - 5) / 3 << " 1 "
         << "0\n";
  }
}
int main() {
  inputoutput();
  int t = 1;
  cin >> t;
  while (t--) solve();
}
