#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a, b, c, flag = 0;
    if (n < 3)
      cout << "-1" << endl;
    else if (n % 3 == 0)
      cout << n / 3 << " "
           << "0"
           << " "
           << "0" << endl;
    else if (n % 5 == 0)
      cout << "0"
           << " " << n / 5 << " "
           << "0" << endl;
    else if (n % 7 == 0)
      cout << "0"
           << " "
           << "0"
           << " " << n / 7 << endl;
    else {
      for (long long i = 1; i < n; i++) {
        a = i;
        b = n - (i * 3);
        if (b < 3) {
          cout << "-1" << endl;
          break;
        } else if (b % 5 == 0) {
          cout << i << " " << b / 5 << " "
               << "0" << endl;
          break;
        } else if (b % 7 == 0) {
          cout << i << " "
               << "0"
               << " " << b / 7 << endl;
          break;
        }
      }
    }
  }
  return 0;
}
