#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 50;
int T, n;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    if (n < 3 || n == 4)
      puts("-1");
    else if (n == 7)
      puts("0 0 1");
    else {
      for (int i = 0; i * 3 <= n; ++i) {
        int p = n - i * 3;
        if (p % 5 == 0) {
          printf("%d %d 0\n", i, p / 5);
          break;
        }
      }
    }
  }
}
