#include <bits/stdc++.h>
using namespace std;
long long a[300200], b[300009], cc[300009];
map<long long, long long> mp;
int main() {
  cin.sync_with_stdio(false);
  long long i, j, k, l, c, v, n, m, r, t, tt;
  long long x1, x2, y1, y2, x3, x4, x5, x6;
  string s, s34, s1, s2, s3;
  cin >> tt;
  while (tt--) {
    cin >> n;
    m = n;
    if (n == 3)
      cout << "1 0 0" << endl;
    else if (n < 5)
      cout << "-1" << endl;
    else if (m % 5 == 0)
      cout << "0 " << m / 5 << " 0" << endl;
    else if (m % 5 == 1) {
      cout << "2 " << (m - 6) / 5 << " 0" << endl;
    } else if (m % 5 == 2) {
      cout << "0 " << (m - 7) / 5 << " 1" << endl;
    } else if (m % 5 == 3) {
      cout << "1 " << (m - 3) / 5 << " 0" << endl;
    } else if (m % 5 == 4) {
      cout << "3 " << (m - 9) / 5 << " 0" << endl;
    }
  }
}
