#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9 + 7;
int gcd(int a, int b) {
  if (a == b) return a;
  if (a % b == 0) return b;
  if (b % a == 0) return a;
  if (b > a) return gcd(a, b % a);
  if (a > b) return gcd(a % b, b);
  return 0;
}
void solve() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n + 1; i++) {
    for (long long j = 0; j < n + 1; j++) {
      for (long long k = 0; k < n + 1; k++) {
        if (3 * i + 5 * j + 7 * k == n) {
          cout << i << " " << j << " " << k;
          return;
        }
      }
    }
  }
  cout << -1;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long t;
  if (0)
    t = 1;
  else
    cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
