#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int d = 0;
    for (int a = 0; a < n; ++a) {
      for (int b = 0; b < n; ++b) {
        if ((n - 3 * a - 5 * b) >= 0 && ((n - 3 * a - 5 * b) % 7 == 0)) {
          cout << a << " " << b << " " << (n - 3 * a - 5 * b) / 7 << "\n";
          d = 1;
        }
        if (d == 1) break;
      }
      if (d == 1) break;
    }
    if (d == 0) cout << "-1\n";
  }
}
