#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    if (n >= 8) {
      if (n % 3 == 0)
        cout << n / 3 << " 0 0\n";
      else if (n % 5 == 0)
        cout << "0 " << n / 5 << " 0\n";
      else if (n % 7 == 0)
        cout << "0 0 " << n / 7 << "\n";
      else {
        for (long long int i = 1; i <= n / 5; i++) {
          if ((n - 5 * i) % 3 == 0) {
            cout << (n - 5 * i) / 3 << " " << i << " 0\n";
            break;
          }
        }
      }
    } else if (n == 3 || n == 5 || n == 6 || n == 7) {
      if (n == 3) cout << "1 0 0\n";
      if (n == 5) cout << "0 1 0\n";
      if (n == 6) cout << "2 0 0\n";
      if (n == 7) cout << "0 0 1\n";
    } else
      cout << "-1\n";
  }
  return 0;
}
