#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1E9 + 7, INF = 2E18 + 5;
const double PI = 2 * acos(0.0);
const long double EPS = 1.0E-14;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, a = -1, b = -1, c = -1, val, need, ch = 0;
    cin >> n;
    for (int i = 0; i <= 340; i++) {
      for (int j = 0; j <= 340; j++) {
        val = (i * 3) + (j * 5);
        if (val > n) break;
        need = n - val;
        if (need % 7 == 0) {
          a = i, b = j, c = need / 7;
          ch = 1;
          break;
        }
      }
      if (ch) break;
    }
    if (a == -1 and b == -1 and c == -1)
      cout << "-1\n";
    else
      cout << a << " " << b << " " << c << "\n";
  }
  return 0;
}
