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