#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b);
int main() {
  int t;
  cin >> t;
  while (t) {
    int n, q = 0, d = 0;
    cin >> n;
    if (n == 3) {
      cout << "1"
           << " " << 0 << " " << 0 << "\n";
    }
    if (n >= 5) {
      if (n % 5 == 0 || n % 10 == 0) {
        cout << "0"
             << " " << n / 5 << " "
             << "0"
             << "\n";
      }
      if (n % 5 == 1) {
        q = (n / 5) - 1;
        d = (n - 5 * q) / 3;
        cout << d << " " << q << " "
             << "0"
             << "\n";
      } else if (n % 5 == 2) {
        q = (n / 5) - 1;
        d = 1;
        cout << "0"
             << " " << q << " " << d << "\n";
      } else if (n % 5 == 3) {
        q = n / 5;
        d = 1;
        cout << d << " " << q << " "
             << "0"
             << "\n";
      } else if (n % 5 == 4) {
        q = (n / 5) - 1;
        d = 3;
        cout << d << " " << q << " "
             << "0"
             << "\n";
      }
    } else if (n != 3) {
      cout << "-1"
           << "\n";
    }
    t--;
  }
}
