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