#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, j, p = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (p) {
          break;
        }
        for (int k = 0; k < n; k++) {
          if (p == 1) {
            break;
          }
          if ((3 * i) + (5 * j) + (7 * k) == n) {
            cout << i << " " << j << " " << k << endl;
            p = 1;
            break;
          }
        }
      }
    }
    if (!p) {
      cout << "-1" << endl;
    }
    p = 0;
  }
}
