#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    vector<vector<int>> dp(n + 1, vector<int>(3, -1));
    dp[0] = {0, 0, 0};
    for (int i = 3; i <= n; i++) {
      if (dp[i - 3][0] >= 0)
        dp[i] = {dp[i - 3][0] + 1, dp[i - 3][1], dp[i - 3][2]};
      if (i - 5 >= 0 && dp[i - 5][1] >= 0)
        dp[i] = {dp[i - 5][0], dp[i - 5][1] + 1, dp[i - 5][2]};
      if (i - 7 >= 0 && dp[i - 7][2] >= 0)
        dp[i] = {dp[i - 7][0], dp[i - 7][1], dp[i - 7][2] + 1};
    }
    if (dp[n][0] == -1)
      cout << -1 << endl;
    else
      cout << dp[n][0] << " " << dp[n][1] << " " << dp[n][2] << endl;
  }
}
