#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  if (n < 3) {
    cout << -1 << endl;
    return;
  }
  if (n % 3 == 0) {
    cout << n / 3 << " " << 0 << " " << 0 << endl;
    return;
  }
  if (n % 5 == 0) {
    cout << 0 << " " << n / 5 << " " << 0 << endl;
    return;
  }
  if (n % 7 == 0) {
    cout << 0 << " " << 0 << " " << n / 7 << endl;
    return;
  }
  if (n == 4) {
    cout << -1 << endl;
    return;
  }
  long long three = 0, five = 0, seven = 0;
  while (true) {
    n -= 3;
    three++;
    if (n % 3 == 0) {
      cout << n / 3 + three << " " << five << " " << seven << endl;
      return;
    }
    if (n % 5 == 0) {
      cout << three << " " << n / 5 << " " << 0 << endl;
      return;
    }
    if (n % 7 == 0) {
      cout << three << " " << 0 << " " << n / 7 << endl;
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  while (n--) solve();
  return 0;
}
