#include <bits/stdc++.h>
int main() {
  using namespace std;
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    auto solve = [&]() {
      for (int c = 0; c <= n / 7; ++c) {
        for (int b = 0; b <= (n - 7 * c) / 5; ++b) {
          if ((n - 5 * b - 7 * c) % 3 == 0) {
            cout << (n - 5 * b - 7 * c) / 3 << ' ' << b << ' ' << c << '\n';
            return;
          }
        }
      }
      cout << -1 << '\n';
    };
    solve();
  }
}
