#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, f = 0;
    cin >> n;
    int xx = n / 3;
    int yy = n / 5;
    int zz = n / 7;
    for (int x = 0; x <= xx; x++) {
      for (int y = 0; y <= yy; y++) {
        for (int z = 0; z <= zz; z++) {
          int dm = (3 * x) + (5 * y) + (7 * z);
          if (dm == n) {
            cout << x << " " << y << " " << z << endl;
            f = 1;
            break;
          }
        }
        if (f == 1) break;
      }
      if (f == 1) break;
    }
    if (f == 0) cout << "-1" << endl;
  }
  return 0;
}
