#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  scanf("%d", &n);
  int x5 = 0, x7 = 0;
  if (n % 3 != 0) {
    if (n % 3 == 2) {
      n -= 5;
      x5 = 1;
    } else {
      n -= 7;
      x7 = 1;
    }
  }
  if (n < 0)
    puts("-1");
  else
    printf("%d %d %d\n", n / 3, x5, x7);
}
int main() {
  int t = 1;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
