#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int k = n % 3;
  if (k == 0) {
    cout << n / 3 << " 0 0\n";
  } else if (k == 1) {
    if (n < 7) {
      cout << "-1\n";
    } else {
      int a = (n - 7) / 3;
      cout << a << " 0 1\n";
    }
  } else {
    if (n < 5) {
      cout << "-1\n";
    } else {
      int a = (n - 5) / 3;
      cout << a << " 1 0\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    solve();
  }
}
