#include <bits/stdc++.h>
using namespace std;
long long int vis[2005][2005];
long long int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int32_t main() {
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    if (n == 1 || n == 2 || n == 4)
      cout << -1;
    else if (n % 3 == 0)
      cout << n / 3 << " " << 0 << " " << 0;
    else if (n % 5 == 0)
      cout << 0 << " " << n / 5 << " " << 0;
    else if (n % 7 == 0)
      cout << 0 << " " << 0 << " " << n / 7;
    else if (n % 3 == 2) {
      long long int cnt = 0;
      while (n % 5 != 0) {
        n -= 3;
        cnt++;
      }
      cout << cnt << " " << n / 5 << " " << 0;
    } else if (n % 3 == 1) {
      long long int cnt = 0;
      while (n % 7 != 0) {
        n -= 3;
        cnt++;
      }
      cout << cnt << " " << 0 << " " << n / 7;
    }
    cout << endl;
  }
  return 0;
}
