#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i;
    cin >> n;
    if (n == 1 || n == 2 || n == 4) {
      cout << "-1" << endl;
      continue;
    }
    int s = n / 7, t = 0, f = 0;
    int r = n % 7;
    if (r == 1) {
      s--;
      f++;
      t++;
    } else if (r == 2) {
      s--;
      t += 3;
    } else if (r == 3) {
      t++;
    } else if (r == 4) {
      s--;
      f++;
      t += 2;
    } else if (r == 5) {
      f++;
    } else if (r == 6) {
      t += 2;
    }
    cout << t << " " << f << " " << s << endl;
  }
}
