#include <bits/stdc++.h>
using namespace std;
int main() {
  int cases;
  cin >> cases;
  int i = 0;
  while (i < cases) {
    i++;
    int a, b, c;
    int n;
    cin >> n;
    if (n <= 4 && n != 3) {
      cout << -1 << endl;
      continue;
    }
    int quot;
    quot = n / 3;
    int mod = n % 3;
    if (mod == 0) {
      a = quot;
      b = 0;
      c = 0;
    }
    if (mod == 1) {
      quot = quot - 2;
      mod = mod + 6;
      a = quot;
      b = 0;
      c = mod;
    }
    if (mod == 2) {
      quot = quot - 1;
      mod = mod + 3;
      a = quot;
      b = mod;
      c = 0;
    }
    cout << a << " " << b / 5 << " " << c / 7 << endl;
  }
}
