#include <bits/stdc++.h>
using namespace std;
void cp() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  cp();
  long long x;
  cin >> x;
  while (x--) {
    long long n;
    cin >> n;
    ;
    if (n % 3 == 0) {
      cout << n / 3 << " ";
      cout << "0 ";
      cout << "0 ";
    } else if (n % 3 == 1) {
      if (n - 7 >= 0) {
        cout << (n - 7) / 3 << " ";
        cout << "0 ";
        cout << "1 ";
      } else {
        cout << "-1";
      }
    } else {
      if (n - 5 >= 0) {
        cout << (n - 5) / 3 << " ";
        cout << "1 ";
        cout << "0 ";
      } else {
        cout << "-1";
      }
    }
    cout << endl;
    ;
  }
}
