#include <bits/stdc++.h>
using namespace std;
int T;
int main() {
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    bool you = false;
    for (int i = 0; i * 3 <= n; i++) {
      if (you) break;
      for (int j = 0; i * 3 + j * 5 <= n; j++) {
        if (you) break;
        if ((n - i * 3 - j * 5) % 7 == 0) {
          you = true;
          cout << i << ' ' << j << ' ' << (n - i * 3 - j * 5) / 7 << endl;
        }
      }
    }
    if (!you) {
      cout << -1 << endl;
    }
  }
  return 0;
}
