#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    bool ok = false;
    for (int i = 0; i <= n / 7; i++) {
      if (!ok) {
        for (int j = 0; j <= n / 5; j++) {
          int k = n - i * 7 - j * 5;
          if (k % 3 == 0) {
            cout << (k / 3) << " " << j << " " << i << "\n";
            ok = true;
            break;
          }
        }
      }
    }
    if (!ok) cout << "-1\n";
  }
  return 0;
}
