#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pr = pair<int, int>;
void trace() {}
template <typename T = string, typename... Tail>
void trace(T first, Tail... tail) {}
int main() {
  int t = 1;
  cin >> t;
  vector<string> pre(15, "-1\n");
  pre[3] = "1 0 0\n";
  pre[5] = "0 1 0\n";
  pre[6] = "2 0 0\n";
  pre[7] = "0 0 1\n";
  pre[8] = "1 1 0\n";
  pre[9] = "3 0 0\n";
  pre[10] = "0 2 0\n";
  pre[11] = "2 1 0\n";
  pre[12] = "4 0 0\n";
  pre[13] = "2 0 1\n";
  pre[14] = "0 0 2\n";
  while (t--) {
    int n;
    cin >> n;
    if (n < 15) {
      cout << pre[n];
      continue;
    }
    if (n % 3 == 0) {
      cout << n / 3 << " 0 0\n";
    } else if (n % 3 == 1) {
      int x = n / 3;
      cout << x - 2 << " 0 1\n";
    } else {
      int x = n / 3;
      cout << x - 1 << " 1 0\n";
    }
  }
  return 0;
}
