#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n, a, b, c, d, x, y, z;
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    x = n / 3;
    y = n % 3;
    if (y == 0)
      cout << x << " " << 0 << " " << 0 << endl;
    else if (y == 2 && x >= 1)
      cout << x - 1 << " " << 1 << " " << 0 << endl;
    else if (y == 1 && x >= 2)
      cout << x - 2 << " " << 0 << " " << 1 << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
