#include <bits/stdc++.h>
using namespace std;
long long dp[1001];
vector<long long> ans;
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
}
long long solve(long long n, long long a, long long b, long long c) {
  if (n < 0) return 0;
  if (!n) {
    long long len = ans.size();
    if (!len) {
      ans.push_back(a);
      ans.push_back(b);
      ans.push_back(c);
    }
    return 1;
  }
  if (dp[n] == -1) {
    long long x = solve(n - 3, a + 1, b, c);
    long long y = solve(n - 5, a, b + 1, c);
    long long z = solve(n - 7, a, b, c + 1);
    dp[n] = x | y | z;
  }
  return dp[n];
}
int main() {
  fastio();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    ans.clear();
    memset(dp, -1, sizeof(dp));
    long long x = solve(n, 0, 0, 0);
    if (!dp[n])
      cout << "-1\n";
    else
      cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
  }
  return 0;
}
