#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<bool> possible(1010);
  possible[0] = true;
  for (int i = 0; i < 1000; ++i) {
    if (!possible[i])
      continue;
    else {
      possible[i + 3] = true;
      possible[i + 5] = true;
      possible[i + 7] = true;
    }
  }
  int t;
  cin >> t;
  for (int tt = 0; tt < t; ++tt) {
    int n;
    cin >> n;
    if (!possible[n]) {
      cout << "-1\n";
      continue;
    } else {
      vector<int64_t> ans(3);
      while (n != 0) {
        if (possible[n - 3]) {
          n -= 3;
          ans[0]++;
        } else if (possible[n - 5]) {
          n -= 5;
          ans[1]++;
        } else {
          n -= 7;
          ans[2]++;
        }
      }
      cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
    }
  }
  return 0;
}
