#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    if (n == 1 || n == 2 || n == 4) {
      printf("-1\n");
      continue;
    }
    if (!(n % 3))
      printf("%d %d %d\n", (n / 3), 0, 0);
    else if (n % 3 == 1)
      printf("%d %d %d\n", (n - 7) / 3, 0, 1);
    else
      printf("%d %d %d\n", (n - 5) / 3, 1, 0);
  }
  return 0;
}
