#include <bits/stdc++.h>
const unsigned long long inf = 1e18;
const int range = 1e6;
const long long inff = 1e-12;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {-1, 0, 0, 1};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
using namespace std;
bool cmp(const pair<long long, long long>& a,
         const pair<long long, long long>& b) {
  return (a.second > b.second);
}
void vecp(vector<long long> v) {
  for (int i = 0; i < int((v).size()); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long l, r, n, c, a = 1, b = 1, cas = 1, d, x1, x2, y1, y2, t, z, y, x;
  cin >> t;
  while (t--) {
    cin >> x;
    int f = 0;
    int arr[7] = {3, 5, 7};
    vector<long long> v(3, 0);
    for (int i = 0; i <= 2; i++) {
      if ((x % arr[i]) == 0) {
        f = 1;
        v[i] = x / arr[i];
        break;
      } else {
        long long xx = x - arr[i];
        if (xx >= 1) {
          for (int j = 0; j < 3; j++) {
            if (xx % arr[j] == 0) {
              f = 1;
              v[i] = 1;
              v[j] = xx / arr[j];
              break;
            }
          }
        }
        if (f == 1) {
          break;
        }
      }
      if (f == 1) {
        break;
      }
    }
    if (f == 0) {
      cout << -1 << endl;
    } else {
      vecp(v);
    }
  }
}
