#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a = 0, b = 0, c = 0, d = 0;
    if (n % 3 == 0) {
      a = n / 3;
      d++;
    }
    if (n % 3 == 1 && n > 4) {
      a = n / 3 - 2;
      c = 1;
      d++;
    }
    if (n % 3 == 2 && n > 4) {
      a = n / 3 - 1;
      b = 1;
      d++;
    }
    if (d == 0) {
      cout << -1 << endl;
    } else {
      cout << a << " " << b << " " << c << endl;
    }
  }
  return 0;
}
