#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i <= n / 5; i++) {
    for (int j = 0; j <= (n - 5 * i) / 7; j++) {
      if ((n - 5 * i - 7 * j) % 3 == 0) {
        cout << (n - 5 * i - 7 * j) / 3 << " " << i << " " << j << endl;
        return;
      }
    }
  }
  cout << -1 << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
