#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n, t;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n == 1 || n == 2 || n == 4) {
      cout << "-1" << endl;
    } else if (n % 3 == 0) {
      cout << n / 3 << " " << 0 << " " << 0 << endl;
    } else if ((n - 5) % 3 == 0) {
      cout << (n - 5) / 3 << " " << 1 << " " << 0 << endl;
    } else if ((n - 7) % 3 == 0) {
      cout << (n - 7) / 3 << " " << 0 << " " << 1 << endl;
    }
  }
}
