#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int flg = 0, i, j, k;
    for (i = 0; i <= 343; i++) {
      for (j = 0; j <= 201; j++) {
        for (k = 0; k <= 143; k++) {
          if ((3 * i + 5 * j + 7 * k) > n)
            break;
          else if ((3 * i + 5 * j + 7 * k) == n) {
            flg = 1;
            break;
          } else {
            continue;
          }
        }
        if (flg == 1) {
          break;
        }
      }
      if (flg == 1) {
        break;
      }
    }
    if (flg == 0) {
      cout << -1 << endl;
      continue;
    } else {
      cout << i << " " << j << " " << k << endl;
    }
  }
  return 0;
}
