#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int x = n / 3, r = n % 3;
    if (r == 0) {
      cout << x << " " << 0 << " " << 0 << endl;
    } else {
      if (r == 1) {
        int x3 = 1, x2 = 0;
        if (x < 2) {
          cout << -1 << endl;
        } else {
          x -= 2 * x3;
          cout << x << " " << x2 << " " << x3 << endl;
        }
      } else {
        int x3 = 0, x2 = 1;
        if (x < 1) {
          cout << -1 << endl;
        } else {
          x -= x2;
          cout << x << " " << x2 << " " << x3 << endl;
        }
      }
    }
  }
}
