#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    if (n % 3 == 0)
      printf("%d %d %d\n", n / 3, 0, 0);
    else if (n % 3 == 1) {
      if (n >= 7)
        printf("%d %d %d\n", (n - 7) / 3, 0, 1);
      else
        cout << -1 << endl;
    } else if (n % 3 == 2) {
      if (n >= 5)
        printf("%d %d %d\n", (n - 5) / 3, 1, 0);
      else
        cout << -1 << endl;
    }
  }
  return 0;
}
