#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n < 3 || n == 4)
      cout << -1 << endl;
    else {
      int a = n % 7;
      if (a == 0)
        cout << "0 0 " << n / 7 << endl;
      else if (a == 1)
        cout << "1 1 " << n / 7 - 1 << endl;
      else if (a == 2)
        cout << "3 0 " << n / 7 - 1 << endl;
      else if (a == 3)
        cout << "1 0 " << n / 7 << endl;
      else if (a == 4)
        cout << "2 1 " << n / 7 - 1 << endl;
      else if (a == 5)
        cout << "0 1 " << n / 7 << endl;
      else
        cout << "2 0 " << n / 7 << endl;
    }
  }
}
