#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  ;
  int z;
  cin >> z;
  for (; z--;) {
    int a;
    cin >> a;
    int eso, fl = 0;
    for (int q = 0; q * 7 <= a && !fl; q++) {
      for (int w = 0; w * 5 + q * 7 <= a && !fl; w++) {
        eso = (a - w * 5 - q * 7);
        if (eso >= 0 && eso % 3 == 0) {
          cout << eso / 3 << " " << w << " " << q << "\n";
          fl = 1;
          break;
        }
      }
    }
    if (!fl) cout << "-1\n";
  }
}
