#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int prime(int n) {
  int i;
  for (int i = 2; i < sqrt(n); i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T;
  cin >> T;
  while (T--) {
    long long int n, i, j;
    cin >> n;
    if (n % 3 == 0)
      cout << n / 3 << " " << 0 << " " << 0 << "\n";
    else if (n % 5 == 0)
      cout << 0 << " " << n / 5 << " " << 0 << "\n";
    else if (n % 7 == 0)
      cout << 0 << " " << 0 << " " << n / 7 << "\n";
    else if ((n > 7) && ((n - 7) % 5 == 0 || (n - 7) % 3 == 0)) {
      if ((n - 7) % 5 == 0)
        cout << 0 << " " << (n - 7) / 5 << " " << 1 << "\n";
      else if ((n - 7) % 3 == 0)
        cout << (n - 7) / 3 << " " << 0 << " " << 1 << "\n";
      else
        cout << -1 << "\n";
    } else if ((n > 3) && ((n - 3) % 5 == 0 || (n - 3) % 7 == 0)) {
      if ((n - 3) % 5 == 0)
        cout << 1 << " " << (n - 3) / 5 << " " << 0 << "\n";
      else if ((n - 3) % 7 == 0)
        cout << 1 << " " << 0 << " " << (n - 3) / 7 << "\n";
      else
        cout << -1 << "\n";
    } else if (n > 5 && ((n - 5) % 3 == 0 || (n - 5) % 7 == 0)) {
      if ((n - 5) % 3 == 0)
        cout << (n - 5) / 3 << " " << 1 << " " << 0 << "\n";
      else if ((n - 5) % 7 == 0)
        cout << 0 << " " << (n - 5) / 7 << " " << 1 << "\n";
      else
        cout << -1 << "\n";
    } else
      cout << -1 << "\n";
  }
  return 0;
}
