#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " -> " << a << endl;
  err(++it, args...);
}
bool dp[10005];
int ans[10005][3];
void testcase() {
  int n;
  cin >> n;
  if (dp[n]) {
    cout << ans[n][0] << " " << ans[n][1] << " " << ans[n][2] << "\n";
  } else
    cout << "-1\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  dp[0] = 1;
  ans[0][0] = ans[0][1] = ans[0][2] = 0;
  for (int i{1}; i < 1005; i++) {
    if (i - 3 >= 0 && dp[i - 3]) {
      dp[i] = true;
      ans[i][0] = ans[i - 3][0] + 1;
      ans[i][1] = ans[i - 3][1];
      ans[i][2] = ans[i - 3][2];
    } else if (i - 5 >= 0 && dp[i - 5]) {
      dp[i] = true;
      ans[i][0] = ans[i - 5][0];
      ans[i][1] = ans[i - 5][1] + 1;
      ans[i][2] = ans[i - 5][2];
    } else if (i - 7 >= 0 && dp[i - 7]) {
      dp[i] = true;
      ans[i][0] = ans[i - 7][0];
      ans[i][1] = ans[i - 7][1];
      ans[i][2] = ans[i - 7][2] + 1;
    }
  }
  int t;
  cin >> t;
  while (t--) {
    testcase();
  }
  return 0;
}
