#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int x = 3 + 5;
    long long int y = 5 + 7;
    long long int z = 3 + 7;
    long long int a = 3 + 5 + 7;
    if (n == 1 || n == 2 || n == 4) {
      cout << -1 << '\n';
    } else {
      long long int p = n % 3;
      if (p == 0) {
        cout << n / 3 << " " << 0 << " " << 0 << '\n';
      } else if (p == 1) {
        cout << (n / 3) - 2 << " " << 0 << " " << 1 << '\n';
      } else {
        cout << (n / 3) - 1 << " " << 1 << " " << 0 << '\n';
      }
    }
  }
  return 0;
}
