#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    bool flag = true;
    int x;
    std::cin >> x;
    for (int a = 0; a <= 1000; a += 3) {
      for (int b = 0; b <= 1000 - a; b += 5) {
        for (int c = 0; c <= 1000 - a - b; c += 7)
          if (a + b + c == x) {
            std::cout << a / 3 << " " << b / 5 << " " << c / 7 << std::endl;
            flag = false;
            break;
          }
        if (!flag) break;
      }
      if (!flag) break;
    }
    if (flag) std::cout << -1 << std::endl;
  }
}
