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