#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n < 3)
      cout << -1 << endl;
    else {
      int x, y, z;
      bool f = 0;
      for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
          if ((3 * i + 5 * j) == n) {
            x = i;
            y = j;
            z = 0;
            f = 1;
            break;
          } else if ((n - 3 * i - 5 * j) % 7 == 0 && n > (3 * i + 5 * j)) {
            x = i;
            y = j;
            z = (n - 3 * i - 5 * j) / 7;
            f = 1;
            break;
          }
        }
        if (f) break;
      }
      if (f)
        cout << x << " " << y << " " << z << endl;
      else
        cout << -1 << endl;
    }
  }
}
