Recently a new building with a new layout was constructed in Monocarp's hometown. According to this new layout, the building consists of three types of apartments: three-room, five-room, and seven-room apartments. It's also known that each room of each apartment has exactly one window. In other words, a three-room apartment has three windows, a five-room — five windows, and a seven-room — seven windows.

Monocarp went around the building and counted $n$ windows. Now he is wondering, how many apartments of each type the building may have.

Unfortunately, Monocarp only recently has learned to count, so he is asking you to help him to calculate the possible quantities of three-room, five-room, and seven-room apartments in the building that has $n$ windows. If there are multiple answers, you can print any of them.

Here are some examples:

  if Monocarp has counted $30$ windows, there could have been $2$ three-room apartments, $2$ five-room apartments and $2$ seven-room apartments, since $2 \cdot 3 + 2 \cdot 5 + 2 \cdot 7 = 30$;  if Monocarp has counted $67$ windows, there could have been $7$ three-room apartments, $5$ five-room apartments and $3$ seven-room apartments, since $7 \cdot 3 + 5 \cdot 5 + 3 \cdot 7 = 67$;  if Monocarp has counted $4$ windows, he should have mistaken since no building with the aforementioned layout can have $4$ windows. 


-----Input-----

Th first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The only line of each test case contains one integer $n$ ($1 \le n \le 1000$) — the number of windows in the building.


-----Output-----

For each test case, if a building with the new layout and the given number of windows just can't exist, print $-1$.

Otherwise, print three non-negative integers — the possible number of three-room, five-room, and seven-room apartments. If there are multiple answers, print any of them.


-----Example-----
Input
4
30
67
4
14

Output
2 2 2
7 5 3
-1
0 0 2

Difficulty: EASY

Solutions:
for s in [*open(0)][1:]:
	n = int(s)
	print(*[[(n - n % 3 * 7 % 9) // 3, n % 3 // 2, n % 3 % 2], [-1]][3 != n < 5])


t = int(input())
ans = [None] * 1001
for i in range(1001):
	if i == 0:
		ans[i] = (0, 0, 0)
	elif i >= 3 and ans[i - 3]:
		(x, y, z) = ans[i - 3]
		x += 1
		ans[i] = (x, y, z)
	elif i >= 5 and ans[i - 5]:
		(x, y, z) = ans[i - 5]
		y += 1
		ans[i] = (x, y, z)
	elif i >= 7 and ans[i - 7]:
		(x, y, z) = ans[i - 7]
		z += 1
		ans[i] = (x, y, z)
	else:
		ans[i] = False
for case in range(t):
	n = int(input())
	if ans[n] == False:
		print(-1)
	else:
		print(*ans[n])


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		ans = n // 3
		if ans >= 2:
			print(ans - 2, 0, 1)
		else:
			print(-1)
	elif n % 3 == 2:
		ans = n // 3
		if ans >= 1:
			print(ans - 1, 1, 0)
		else:
			print(-1)


t = int(input())
while t:
	t -= 1
	win = int(input())
	if win == 1 or win == 2 or win == 4:
		print(-1)
	elif win % 3 == 0:
		print(win // 3, 0, 0)
	elif win % 3 == 1:
		print(win // 3 - 2, 0, 1)
	else:
		print(win // 3 - 1, 1, 0)


for i in range(int(input())):
	n = int(input())
	c3 = n // 3
	if n % 3 == 0:
		print(c3, 0, 0)
	elif n % 3 == 1:
		if c3 - 2 < 0:
			print(-1)
		else:
			print(c3 - 2, 0, 1)
	elif c3 - 1 < 0:
		print(-1)
	else:
		print(c3 - 1, 1, 0)


def check(n):
	three = 0
	five = 0
	seven = 0
	if n < 3 or n == 4:
		print(-1)
	elif n == 3:
		print(1, 0, 0)
	elif n == 5:
		print(0, 1, 0)
	elif n == 7:
		print(0, 0, 1)
	elif n % 3 == 0:
		three = n // 3
		print(three, five, seven)
	elif n % 3 == 1:
		three = n // 3 - 2
		seven = 1
		print(three, five, seven)
	elif n % 3 == 2:
		three = n // 3 - 1
		five = 1
		print(three, five, seven)
for _ in range(int(input())):
	n = int(input())
	check(n)


class solution:

	def ans(k):
		lst = [0, 0, 0]
		if k < 5 and k != 3:
			return -1
		quotient = k // 3
		remainder = k % 3
		if remainder == 0:
			lst[0] = quotient
			return lst
		elif remainder == 1:
			lst[0] = quotient - 2
			lst[2] = 1
			return lst
		else:
			lst[0] = quotient - 1
			lst[1] = 1
			return lst
t = ''
for i in range(int(input())):
	k = int(input())
	res = solution.ans(k)
	if res != -1:
		print(f'{res[0]} {res[1]} {res[2]}')
	else:
		print(-1)


a = int(input())
for x in range(a):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
		continue
	b = n // 3
	if n % 3 == 1:
		print(b - 2, 0, 1)
	elif n % 3 == 0:
		print(b, 0, 0)
	else:
		print(b - 1, 1, 0)


t = int(input())
for z in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)
	else:
		print(n // 3, 0, 0)


import collections
d = collections.defaultdict(list)
d[3] = [1, 0, 0]
d[5] = [0, 1, 0]
d[6] = [2, 0, 0]
d[7] = [0, 0, 1]
l = [1, 0, 0, 1, 0, 1, 1, 1]
for i in range(8, 1001):
	if l[i - 3] == 1:
		l.append(1)
		d[i].append(d[i - 3][0] + 1)
		d[i].append(d[i - 3][1])
		d[i].append(d[i - 3][2])
	elif l[i - 5] == 1:
		l.append(1)
		d[i].append(d[i - 5][0])
		d[i].append(d[i - 5][1] + 1)
		d[i].append(d[i - 5][0])
	elif l[i - 7] == 1:
		l.append(1)
		d[i].append(d[i - 7][0])
		d[i].append(d[i - 7][1])
		d[i].append(d[i - 7][2] + 1)
	else:
		l.append(0)
for _ in range(int(input())):
	n = int(input())
	if l[n] == 1:
		print(d[n][0], d[n][1], d[n][2])
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())

	def dfs(n, x, y, z):
		if n == 0:
			print(str(x) + ' ' + str(y) + ' ' + str(z))
			return True
		if n >= 3:
			if dfs(n - 3, x + 1, y, z):
				return True
		if n >= 5:
			if dfs(n - 5, x, y + 1, z):
				return True
		if n >= 7:
			if dfs(n - 7, x, y, z + 1):
				return True
		return False
	if not dfs(n, 0, 0, 0):
		print(-1)


n = int(input())
ans = []
for i in range(n):
	a = int(input())
	if a > 7:
		if a % 3 == 0:
			ans.append(str(a // 3) + ' 0 0')
		elif a % 3 == 1:
			ans.append(str((a - 7) // 3) + ' 0 1')
		elif a % 3 == 2:
			ans.append(str((a - 5) // 3) + ' 1 0')
	elif a % 3 == 0:
		ans.append(str(a // 3) + ' 0 0')
	elif a % 5 == 0:
		ans.append('0 1 0')
	elif a % 7 == 0:
		ans.append('0 0 1')
	else:
		ans.append('-1')
for r in ans:
	print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print('{0} 0 0'.format(n // 3))
	elif n % 3 == 1:
		print('{0} 0 1'.format((n - 7) // 3))
	else:
		print('{0} 1 0'.format((n - 5) // 3))


from bisect import *
from collections import *
from math import *
from heapq import *
from typing import List
from itertools import *
from operator import *
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

@lru_cache(None)
def fact(x):
	if x < 2:
		return 1
	return fact(x - 1) * x

@lru_cache(None)
def per(i, j):
	return fact(i) // fact(i - j)

@lru_cache(None)
def com(i, j):
	return per(i, j) // fact(j)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 1
	res = 0
	for w in arr:
		res += w
		if res > x:
			res = w
		c += 1
	return c

def lowbit(n):
	return n & -n

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d
t = N()
s = {1, 2, 4}
for i in range(t):
	n = N()
	if n in s:
		print(-1)
	else:
		if n % 3 == 0:
			ans = [n // 3, 0, 0]
		elif n % 3 == 1:
			ans = [(n - 7) // 3, 0, 1]
		else:
			ans = [(n - 5) // 3, 1, 0]
		print(*ans)


import math
from collections import Counter
from itertools import permutations, combinations
import fractions

def solve():
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
		return
	if n % 3 == 0:
		print(str(n // 3) + ' 0 0')
	elif n % 3 == 1:
		print(str((n - 7) // 3) + ' 0 1')
	else:
		print(str((n - 5) // 3) + ' 1 0')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for m in range(t):
	n = int(input())
	arr = [0, [-1], [-1], [1, 0, 0], [-1], [0, 1, 0], [2, 0, 0], [0, 0, 1]]
	for i in range(8, n + 1):
		if arr[i - 3] != [-1]:
			p = arr[i - 3][0] + 1
			arr.append([p, arr[i - 3][1], arr[i - 3][2]])
		elif arr[i - 5] != [-1]:
			p = arr[i - 5][1] + 1
			arr.append([arr[i - 5][0], p, arr[i - 5][2]])
		elif arr[i - 7] != [-1]:
			p = arr[i - 7][2] + 1
			arr.append([arr[i - 7][0], arr[i - 7][1], p])
		else:
			arr.append(-1)
	print(*arr[n])


import math
t = int(input())
while t:
	t -= 1
	y = [int(i) for i in input().split()]
	n = y[0]
	total = n // 3
	rem = n % 3
	if rem == 0:
		print(total, 0, 0)
	elif n >= 7 and rem == 1:
		print(total - 2, 0, 1)
	elif n >= 5 and rem == 2:
		print(total - 1, 1, 0)
	else:
		print(-1)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(f'{n // 3} 0 0')
	elif n % 3 == 1:
		print(f'{n // 3 - 2} 0 1')
	else:
		print(f'{n // 3 - 1} 1 0')


for i in range(int(input())):
	r = int(input())
	if r == 1 or r == 2 or r == 4:
		print(-1)
	elif r % 3 == 0:
		print(r // 3, 0, 0)
	elif r % 3 == 2:
		print((r - 5) // 3, 1, 0)
	else:
		print((r - 7) // 3, 0, 1)


a = int(input())
while a:
	a -= 1
	f = int(input())
	if f == 1 or f == 2 or f == 4:
		print(-1)
	elif f % 3 == 0:
		print(f // 3, 0, 0)
	elif f % 3 == 1:
		print(f // 3 - 2, 0, 1)
	else:
		print(f // 3 - 1, 1, 0)


for _ in range(int(input())):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
		continue
	a = n // 3
	b = 0
	c = 0
	if n == 7:
		print(0, 0, 1)
	elif n == 5:
		print(0, 1, 0)
	elif n % 3 == 1:
		if a > 2:
			print(a - 2, 0, 1)
	elif n % 3 == 2:
		print(a - 1, 1, 0)
	else:
		print(a, b, c)


test_cases = int(input())
for t in range(test_cases):
	n = int(input())
	if n in [0, 1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	else:
		print(n // 3 - 1, 1, 0)


input = __import__('sys').stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	n = ii()
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	else:
		print((n - 7) // 3, 0, 1)


n = int(input())
lst = []
for i in range(0, n):
	ele = int(input())
	lst.append(ele)
for i in lst:
	if i < 3 or i == 4:
		print('-1')
	elif i % 3 == 0:
		print(i // 3, '0 0')
	elif i % 3 == 1:
		print(i // 3 - 2, '0 1')
	else:
		print(i // 3 - 1, '1 0')


for i in range(int(input())):
	tmp = int(input())
	if tmp in [1, 2, 4]:
		print(-1)
		continue
	o = tmp % 3
	if o == 0:
		print(tmp // 3, 0, 0)
	elif o == 1:
		print(tmp // 3 - 2, 0, 1)
	elif o == 2:
		print(tmp // 3 - 1, 1, 0)


a = int(input())
for i in range(a):
	b = int(input())
	if (b - 5) % 3 == 0 and b - 5 >= 0:
		print((b - 5) // 3, 1, 0)
	elif (b - 7) % 3 == 0 and b - 7 >= 0:
		print((b - 7) // 3, 0, 1)
	elif b % 3 == 0:
		print(b // 3, 0, 0)
	elif (b - 3) % 7 == 0 and b - 3 >= 0:
		print(1, 0, (b - 3) // 7)
	elif (b - 5) % 7 == 0 and b - 5 >= 0:
		print(0, 1, (b - 5) // 7)
	elif b % 7 == 0:
		print(b // 7, 0, 0)
	elif (b - 3) % 5 == 0 and b - 3 >= 0:
		print((1, (b - 3) // 5, 0))
	elif (b - 7) % 5 == 0 and b - 7 >= 0:
		print(0, (b - 7) // 5, 1)
	elif b % 5 == 0:
		print(0, b // 5, 0)
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	l = [0] * 3
	x = n
	l[0] = x // 3
	x = l[0] * 3
	if x != n:
		while 1:
			if (x + 5 != n and x + 7 != n) and x > 0:
				x -= 3
				l[0] -= 1
			else:
				break
	if x + 5 == n:
		l[1] = 1
		print(*l)
	elif x + 7 == n:
		l[2] = 1
		print(*l)
	elif l[0] > 0:
		print(*l)
	else:
		print(-1)


def apts(windows, prev):
	if windows < 0:
		return -1
	if windows == 0:
		ans = [0 for _ in range(8)]
		ans[prev] += 1
		return ans
	ans = apts(windows - 3, 3)
	if ans != -1:
		ans[prev] += 1
		return ans
	ans = apts(windows - 5, 5)
	if ans != -1:
		ans[prev] += 1
		return ans
	ans = apts(windows - 7, 7)
	if ans != -1:
		ans[prev] += 1
		return ans
	return -1
tc = int(input())
for _ in range(tc):
	windows = int(input())
	ans = apts(windows, 0)
	if ans == -1:
		print(-1)
	else:
		print(ans[3], ans[5], ans[7])


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(str(n // 3) + ' 0 0')
	elif n % 3 == 1:
		n -= 7
		if n < 0:
			print(-1)
		else:
			print(str(n // 3) + ' 0 1')
	elif n % 3 == 2:
		n -= 5
		if n < 0:
			print(-1)
		else:
			print(str(n // 3) + ' 1 0')


for _ in range(int(input())):
	n = int(input())
	rem = n % 3
	if rem == 0:
		print(n // 3, 0, 0)
	elif rem == 1:
		n -= 6
		if n < 0:
			print(-1)
		else:
			print(n // 3, 0, 1)
	else:
		n -= 3
		if n < 0:
			print(-1)
		else:
			print(n // 3, 1, 0)


import math
import sys
import collections
import bisect
input = sys.stdin.readline
flush = sys.stdout.flush
readint = lambda : int(input())
readintm = lambda : map(int, input().strip().split())
readintl = lambda : list(map(int, input().strip().split()))
readfloatm = lambda : map(float, input().strip().split())
readfloatl = lambda : list(map(float, input().strip().split()))
readstr = lambda : input().strip()
readstrl = lambda : list(input().strip())
join = lambda x, l: x.join(map(str, l))
print = lambda x: sys.stdout.write(str(x))
mod = 1000000007
impossible = set([1, 2, 4])
for _ in range(readint()):
	n = readint()
	if n in impossible:
		print(-1)
	elif n % 3 == 0:
		print(join(' ', (n // 3, 0, 0)))
	elif n % 3 == 1:
		print(join(' ', ((n - 7) // 3, 0, 1)))
	else:
		print(join(' ', ((n - 5) // 3, 1, 0)))
	print('\n')


import sys, math, cmath, time, collections
start_time = time.time()

def solve():
	n = inp()
	if n != 3 and n < 5:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(1, t + 1):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def power_two(x):
	return x and (not x & x - 1)

def ceil(a, b):
	return -(-a // b)

def seive(n):
	a = [1]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	return a
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


for _ in range(int(input())):
	n = int(input())
	three = n // 3
	five = 0
	seven = 0
	excess = n % 3
	if excess == 2:
		three -= 1
		five = 1
	elif excess == 1:
		three -= 2
		seven += 1
	if three < 0:
		print(-1)
	else:
		print(three, five, seven)


t = int(input())
answers = []
for _ in range(t):
	n = int(input())
	answer = []
	x = 0
	y = 0
	z = 0
	if n % 3 == 0:
		x = n // 3
		answer.append(str(x))
		answer.append(str(y))
		answer.append(str(z))
	elif (n - 5) % 3 == 0 and n - 5 >= 0:
		x = (n - 5) // 3
		y = 1
		answer.append(str(x))
		answer.append(str(y))
		answer.append(str(z))
	elif (n - 7) % 3 == 0 and n - 7 >= 0:
		x = (n - 7) // 3
		z = 1
		answer.append(str(x))
		answer.append(str(y))
		answer.append(str(z))
	else:
		answer.append(str(-1))
	answers.append(answer)
for i in range(t):
	if answers[i] == '-1':
		print(answers[i])
	else:
		print(' '.join(answers[i]))


for t in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		th = 0
		se = 0
		fi = 0
		m = n // 3
		if n % 3 == 0:
			print(n // 3, 0, 0)
		else:
			n -= 3 * (m - 2)
			th += m - 2
			if n == 7:
				se += 1
			elif n == 8:
				fi += 1
				th += 1
			else:
				th += 3
			print(th, fi, se)


t = int(input())
for i in range(t):
	total = int(input())
	if total <= 2 or total == 4:
		print('-1')
		continue
	if total % 3 == 0:
		print('{} {} {}'.format(total // 3, 0, 0))
	elif (total - 5) % 3 == 0:
		print('{} {} {}'.format((total - 5) // 3, 1, 0))
	elif (total - 7) % 3 == 0:
		print('{} {} {}'.format((total - 7) // 3, 0, 1))


def Solve():
	n = int(input())
	rooms = n // 3
	remain = n % 3
	if remain == 0:
		print(rooms, 0, 0)
	elif remain == 1:
		if rooms < 2:
			print(-1)
		else:
			print(rooms - 2, 0, 1)
	elif rooms < 1:
		print(-1)
	else:
		print(rooms - 1, 1, 0)
for _ in range(int(input())):
	Solve()


n = int(input())
for i in range(n):
	w = int(input())
	if w == 4 or w < 3:
		print(-1)
		continue
	if w % 3 == 0:
		print(str(int(w / 3)) + ' 0 0')
		continue
	if w % 3 == 1:
		print(str(int(w / 3) - 2) + ' 0 1')
		continue
	if w % 3 == 2:
		print(str(int(w / 3) - 1) + ' 1 0')
		continue


for n in [*open(0)][1:]:
	n = int(n)
	print(*([-1] if n in [1, 2, 4] else [(n // 3, 0, 0), ((n - 7) // 3, 0, 1), ((n - 5) // 3, 1, 0)][n % 3]))


def do(n):
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)
n = int(input())
for h in range(n):
	g = int(input())
	do(g)


t = int(input())
for case in range(t):
	n = int(input())
	if n == 3:
		print(1, 0, 0)
	elif n == 5:
		print(0, 1, 0)
	elif n == 7:
		print(0, 0, 1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n >= 7:
		if (n - 5) % 3 == 0:
			print((n - 5) // 3, 1, 0)
		else:
			print((n - 7) // 3, 0, 1)
	else:
		print(-1)


import os
import heapq
import sys, threading
import math
import operator
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def pw(a, b, md):
	result = 1
	while b > 0:
		if b % 2 == 1:
			result *= a
			result %= md
		a *= a
		a %= md
		b //= 2
	return result % md

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		if n < 3 or n == 4:
			print(-1)
		else:
			q = n // 3
			r = n % 3
			if r == 0:
				print(q, 0, 0)
			elif r == 2 and q > 0:
				print(q - 1, 1, 0)
			elif r == 1 and q > 1:
				print(q - 2, 0, 1)
			else:
				print(-1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
threading.Thread(target=main).start()


rn = lambda : int(input())
rns = lambda : map(int, input().split())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()
yn = lambda x: print('Yes') if x else print('No')
YN = lambda x: print('YES') if x else print('NO')
pl = lambda l: print(' '.join(list(map(str, l))))
sieve = 1001 * [-1]
sieve[0] = [0, 0, 0]
s = [3, 5, 7]
for i in range(1001):
	if sieve[i] != -1:
		for j in s:
			if i + j <= 1000:
				sieve[i + j] = sieve[i].copy()
				sieve[i + j][s.index(j)] += 1
for _ in range(rn()):
	n = rn()
	if sieve[n] == -1:
		print(-1)
	else:
		pl(sieve[n])


for _ in range(int(input())):
	n = int(input())
	l = [1, 2, 4]
	if n in l:
		print(-1)
	elif n % 3 == 0:
		ans = n // 3
		print(ans, 0, 0)
	else:
		m3 = n - 3
		m5 = n - 5
		m7 = n - 7
		if m3 % 3 == 0:
			print(m3 // 3 + 1, 0, 0)
		elif m5 % 3 == 0:
			print(m5 // 3, 1, 0)
		elif m7 % 3 == 0:
			print(m7 // 3, 0, 1)
		else:
			print(-1)


def rooms(n):
	if n == 1 or n == 2 or n == 4:
		return [-1]
	elif n % 3 == 0:
		return [n // 3, 0, 0]
	elif n % 3 == 1:
		return [(n - 7) // 3, 0, 1]
	elif n % 3 == 2:
		return [(n - 5) // 3, 1, 0]
n = int(input())
res = []
for i in range(n):
	p = int(input())
	res.append(rooms(p))
for j in res:
	print(*j)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0, sep=' ', end='\n')
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1, sep=' ', end='\n')
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0, sep=' ', end='\n')


def solve(n, l):
	if n == 0:
		res.append(l[:])
		return
	if len(res) >= 1:
		return
	if n >= 3:
		l[0] += 1
		solve(n - 3, l)
		l[0] -= 1
	if n >= 5:
		l[1] += 1
		solve(n - 5, l)
		l[1] -= 1
	if n - 7 >= 0:
		l[2] += 1
		solve(n - 7, l)
		l[2] -= 1
t = int(input())
for _ in range(t):
	n = int(input())
	cur = [0, 0, 0]
	res = []
	solve(n, cur)
	if len(res) == 0:
		print(-1)
	else:
		print(*res[0])


for _ in range(int(input())):
	n = int(input())
	a = n // 3
	b = n // 5
	c = n // 7
	ans = [-1]
	for i in range(a + 1):
		for j in range(b + 1):
			f = n - i * 3 - j * 5
			if f >= 0 and f % 7 == 0:
				ans = [i, j, f // 7]
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	b = 0
	c = 0
	d = n // 3
	if n % 3 == 0:
		print(d, c, b)
	elif n % 3 == 2:
		b = 1
		if d >= 1:
			print(d - 1, b, c)
		else:
			print('-1')
	elif n % 3 == 1:
		c = 1
		if d >= 2:
			print(d - 2, b, c)
		else:
			print('-1')


n = int(input())
temp = [None] * 1010
temp[0] = True
for i in range(1000):
	if not temp[i]:
		continue
	temp[i + 3] = temp[i + 5] = temp[i + 7] = True
for i in range(n):
	x = int(input())
	if temp[x] == None:
		print(-1)
	else:
		counts = [0] * 3
		while x != 0:
			if temp[x - 3] == True:
				counts[0] += 1
				x -= 3
			elif temp[x - 5] == True:
				counts[1] += 1
				x -= 5
			else:
				counts[2] += 1
				x -= 7
		print(str(counts[0]) + ' ' + str(counts[1]) + ' ' + str(counts[2]))


def Solve(e):
	if e == 1 or e == 2 or e == 4:
		print(-1)
		return
	if e % 3 == 0:
		print(abs(e // 3), '0 0')
	elif e % 3 == 1:
		print((e - 7) // 3, '0 1')
	else:
		print((e - 5) // 3, '1 0')
t = int(input())
while t > 0:
	element = int(input())
	Solve(element)
	t = t - 1


def solve(n):
	(t, f, s) = (n // 3, 0, 0)
	if n % (3 * t) == 1:
		if t < 2:
			return (-1, -1, -1)
		else:
			return (t - 2, 0, 1)
	elif n % (3 * t) == 2:
		if t < 1:
			return (-1, -1, -1)
		else:
			return (t - 1, 1, 0)
	else:
		return (t, 0, 0)
t = int(input())
for i in range(t):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	else:
		(k, m, n) = solve(n)
		if k == -1:
			print(-1)
		else:
			print(f'{k} {m} {n}')


import sys
t = int(input())
for tc in range(t):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1 and n > 6:
		print((n - 7) // 3, 0, 1)
	elif n % 3 == 2 and n > 4:
		print((n - 5) // 3, 1, 0)
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	c3 = 0
	c5 = 0
	c7 = 0
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)


from sys import stdin, stdout
n = int(stdin.readline())
lst = [[0, 0, 0] for i in range(1001)]
lst[3] = [1, 0, 0]
lst[5] = [0, 1, 0]
lst[7] = [0, 0, 1]
lst[6] = [2, 0, 0]
for i in range(8, 1001):
	if [0, 0, 0] != lst[i - 3]:
		lst[i] = [lst[i - 3][0] + 1] + lst[i - 3][1:]
		continue
	if [0, 0, 0] != lst[i - 5]:
		lst[i] = [lst[i - 5][0]] + [lst[i - 5][1] + 1] + [lst[i - 5][2]]
		continue
	if [0, 0, 0] != lst[i - 7]:
		lst[i] = lst[i - 7][0:2] + [lst[i - 7][2] + 1]
for i in range(n):
	ans = []
	k = int(stdin.readline())
	for j in lst[k]:
		ans += [str(j)]
	out = ' '.join(ans)
	if lst[k].count(0) == 3:
		out = '-1'
	stdout.write(out + '\n')


import math
from itertools import permutations
import sys
t = int(input())

def solve(n):
	if n < 5 and n != 3:
		print(-1)
		return -1
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)
for _ in range(t):
	n = int(input())
	solve(n)


from collections import *
t = int(input())
L = [(-1, -1, -1)] * 1001
L[0] = (0, 0, 0)
for i in range(3, 1001):
	if L[i - 3] != (-1, -1, -1):
		L[i] = (L[i - 3][0] + 1, L[i - 3][1], L[i - 3][2])
	elif L[i - 5] != (-1, -1, -1):
		L[i] = (L[i - 5][0], L[i - 5][1] + 1, L[i - 5][2])
	elif L[i - 7] != (-1, -1, -1):
		L[i] = (L[i - 7][0], L[i - 7][1], L[i - 7][2] + 1)
for i in range(t):
	n = int(input())
	if L[n][0] == -1:
		print(-1)
	else:
		print(L[n][0], L[n][1], L[n][2])


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		poss = [False for x in range(1001)]
		i = 1
		while i * 3 <= 1001:
			poss[i * 3] = True
			i += 1
		poss[0] = True
		for i in range(5, 1001):
			if i % 5 == 0:
				poss[i] = True
			elif poss[i - 5] == True:
				poss[i] = True
			elif i % 7 == 0:
				poss[i] = True
			elif poss[i - 7] == True:
				poss[i] = True
		for x in range(I()):
			n = I()
			ans = [0, 0, 0]
			flag = 0
			if poss[n] != False:
				while n > 0:
					if poss[n - 3] == True:
						n -= 3
						ans[0] += 1
					elif poss[n - 5] == True:
						n -= 5
						ans[1] += 1
					elif poss[n - 7] == True:
						n -= 7
						ans[2] += 1
					else:
						flag = 1
						break
				print(*ans)
			else:
				print(-1)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


for _ in range(int(input())):
	n = int(input())
	cnt = [0, 0, 0]
	(f, rem) = (n // 3, n % 3)
	if rem == 0:
		cnt = [f, 0, 0]
	elif rem == 1 and f > 1:
		cnt = [f - 2, 0, 1]
	elif rem == 2 and f:
		cnt = [f - 1, 1, 0]
	ans = cnt[0] * 3 + cnt[1] * 5 + cnt[2] * 7
	print(*(cnt if ans == n else [-1]))


import sys as _sys

def main():
	t = int(input())
	for i_t in range(t):
		(n,) = _read_ints()
		try:
			result = find_flats_ns(n)
		except ValueError:
			result = (-1,)
		print(*result)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split())

def find_flats_ns(windows_n):
	assert windows_n >= 0
	if windows_n % 3 == 0:
		result = (windows_n // 3, 0, 0)
	elif windows_n % 3 == 1:
		if windows_n // 3 < 2:
			raise ValueError('impossible argument: %s' % windows_n)
		result = (windows_n // 3 - 2, 0, 1)
	else:
		assert windows_n % 3 == 2
		if windows_n // 3 < 1:
			raise ValueError('impossible argument: %s' % windows_n)
		result = (windows_n // 3 - 1, 1, 0)
	return result
main()


dp = [[0, 0, 0]] * 1001
dp[3] = [1, 0, 0]
dp[5] = [0, 1, 0]
dp[6] = [2, 0, 0]
dp[7] = [0, 0, 1]
for i in range(8, 1001):
	if dp[i - 3] != [0, 0, 0]:
		dp[i] = [dp[i - 3][0] + 1, dp[i - 3][1], dp[i - 3][2]]
	elif dp[i - 5] != [0, 0, 0]:
		dp[i] = [dp[i - 5][0], dp[i - 5][1] + 1, dp[i - 5][2]]
	elif dp[i - 7] != [0, 0, 0]:
		dp[i] = [dp[i - 7][0], dp[i - 7][1], dp[i - 7][2] + 1]
for t in range(int(input())):
	n = int(input())
	if dp[n] == [0, 0, 0]:
		print(-1)
	else:
		(a, b, c) = dp[n]
		print(str(a) + ' ' + str(b) + ' ' + str(c))


k = []
for i in range(int(input())):
	k.append(int(input()))
for x in k:
	if x == 1 or x == 2 or x == 4:
		print(-1)
	elif (x - 5) % 3 == 0:
		print(int((x - 5) / 3), 1, 0)
	elif (x - 5) % 3 == 1:
		print(int(x / 3), 0, 0)
	elif (x - 5) % 3 == 2:
		print(int((x - 5) / 3), 0, 1)


n = int(input())
while n:
	n = n - 1
	d = int(input())
	a = d // 3
	if a * 3 == d:
		print(a, '0 0')
	elif (a - 1) * 3 + 5 == d and a - 1 >= 0:
		print(a - 1, '1 0')
	elif (a - 2) * 3 + 7 == d and a - 2 >= 0:
		print(a - 2, '0 1')
	else:
		print('-1')


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
INF = float('inf')
mod = 10 ** 9 + 7
for t in range(int(data())):
	n = int(data())
	k = n // 3
	if n % 3 == 2:
		if k < 1:
			print(-1)
			continue
		print(k - 1, 1, 0)
	elif n % 3 == 1:
		if k < 2:
			print(-1)
			continue
		print(k - 2, 0, 1)
	else:
		print(k, 0, 0)


from sys import stdin, stdout
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
		continue
	rem = n % 3
	if rem == 0:
		print(n // 3, end=' ')
		print(0, end=' ')
		print(0)
	elif rem == 2:
		n = n - 5
		print(n // 3, end=' ')
		print(1, end=' ')
		print(0)
	else:
		n = n - 7
		print(n // 3, end=' ')
		print(0, end=' ')
		print(1)


def dfs(a, s):
	if s == 0:
		return a
	if s < 0:
		return -1
	for (i, el) in enumerate([3, 5, 7]):
		if s >= el:
			a[i] += 1
			res = dfs(a, s - el)
			if res != -1:
				return res
			a[i] -= 1
	return -1
t = int(input())
for _ in range(t):
	n = int(input())
	a = dfs([0, 0, 0], n)
	if a == -1:
		print('-1')
	else:
		print(*a)


import random

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	k = n % 3
	if k == 0:
		print(n // 3, 0, 0)
	elif k == 1:
		if n >= 7:
			print((n - 7) // 3, 0, 1)
		else:
			print(-1)
	elif k == 2:
		if n >= 5:
			print((n - 5) // 3, 1, 0)
		else:
			print(-1)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math
import threading
import sys
import time

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = get_int()
	if n in [1, 2, 4]:
		print('-1')
	else:
		three = 0
		while n >= 9:
			three += 1
			n -= 3
		if n in [3, 6]:
			print(three + n // 3, 0, 0)
		elif n == 5:
			print(three, 1, 0)
		elif n == 7:
			print(three, 0, 1)
		elif n == 8:
			print(three + 1, 1, 0)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	if n % 3 == 0:
		print('{} {} {}'.format(n // 3, 0, 0))
	elif n % 3 == 1 and n >= 7:
		print('{} {} {}'.format(n // 3 - 2, 0, 1))
	elif n % 3 == 2 and n >= 5:
		print('{} {} {}'.format(n // 3 - 1, 1, 0))
	else:
		print('-1')


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint
pos = [(-float('inf'), -float('inf'), -float('inf'))] * 1001
pos[0] = (0, 0, 0)
for i in range(1001):
	if sum(pos[i]) >= 0:
		if i + 3 < 1001:
			pos[i + 3] = (pos[i][0] + 1, pos[i][1], pos[i][2])
		if i + 5 < 1001:
			pos[i + 5] = (pos[i][0], pos[i][1] + 1, pos[i][2])
		if i + 7 < 1001:
			pos[i + 7] = (pos[i][0], pos[i][1], pos[i][2] + 1)

def main():
	n = int(input())
	if sum(pos[n]) >= 0:
		print(*pos[n])
	else:
		print(-1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


x = int(input())
i = 0
while i < x:
	a = int(input())
	if a == 1 or a == 2 or a == 4:
		print(-1)
	elif a % 3 == 0:
		print(int(a / 3), 0, 0)
	elif a % 3 == 1:
		print(int((a - 7) / 3), 0, 1)
	else:
		print(int((a - 5) / 3), 1, 0)
	i += 1


for i in range(int(input())):
	n = int(input())
	(x, y, z) = (0, 0, 0)
	if n == 4 or n == 2 or n == 1:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	elif (n - 7) % 3 == 0:
		print((n - 7) // 3, 0, 1)


for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	else:
		print(n // 3 - 1, 1, 0)


t = int(input())

def solve(n):
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n >= 5 and (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	elif n >= 7 and (n - 7) % 3 == 0:
		print((n - 7) // 3, 0, 1)
	else:
		print(-1)
for _ in range(t):
	solve(int(input()))


T = int(input())
for _ in range(0, T):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		n -= 7
		if n < 0:
			print(-1)
		else:
			print(n // 3, 0, 1)
	else:
		n -= 5
		if n < 0:
			print(-1)
		else:
			print(n // 3, 1, 0)


for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		rem = n % 3
		a = n // 3
		if rem == 0:
			print(a, 0, 0)
		if rem == 1:
			print(a - 2, 0, 1)
		if rem == 2:
			print(a - 1, 1, 0)


commands = [3, 5, 7]
data = 1001 * [[0, 0, 0]]
for _ in range(3, 1001):
	if _ == 3:
		data[3] = [1, 0, 0]
	elif _ == 5:
		data[5] = [0, 1, 0]
	elif _ == 7:
		data[7] = [0, 0, 1]
	elif _ == 6 or _ > 7:
		if sum(data[_ - 3]) != 0:
			temp = data[_ - 3].copy()
			temp[0] += 1
			data[_] = temp
		elif sum(data[_ - 5]) != 0:
			temp = data[_ - 5].copy()
			temp[1] += 1
			data[_] = temp
		elif sum(data[_ - 7]) != 0:
			temp = data[_ - 7].copy()
			temp[2] += 1
			data[_] = temp
for i in range(int(input())):
	n = int(input())
	print(-1) if data[n] == [0, 0, 0] else print(*data[n])


for t in range(int(input())):
	n = int(input())
	a = n // 3
	if n % 3 == 0:
		print(a, '0 0')
	elif n % 3 == 1:
		a = a - 2
		if a < 0:
			print(-1)
		else:
			print(a, '0 1')
	elif n % 3 == 2:
		a = a - 1
		if a < 0:
			print(-1)
		else:
			print(a, '1 0')


for i in range(int(input())):
	n1 = int(input())
	n = n1
	r7 = 0
	r5 = 0
	r3 = 0
	if n < 3 or n == 4:
		print(-1)
	else:
		if n % 3 == 0:
			r3 += n // 3
		elif (n - 5) % 3 == 0:
			r5 = 1
			r3 += (n - 3) // 3
		else:
			r3 += (n - 7) // 3
			r7 = 1
		print(r3, r5, r7)


for i in range(int(input())):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	else:
		j = n % 3
		if j == 0:
			print(n // 3, 0, 0)
		elif j == 1:
			print(n // 3 - 2, 0, 1)
		else:
			print(n // 3 - 1, 1, 0)


def main():
	test = int(input())
	while test > 0:
		test -= 1
		num = int(input())
		if num == 1 or num == 2 or num == 4:
			print(-1)
		else:
			rem = num % 3
			if rem == 0:
				print(num // 3, 0, 0)
			elif rem == 1:
				print((num - 7) // 3, 0, 1)
			else:
				print((num - 5) // 3, 1, 0)
main()


for t in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	c = 0
	if n > 4 and n != 3:
		while n != 0:
			if n % 3 == 2:
				n -= 5
				b += 1
			elif n % 3 == 1:
				n -= 7
				c += 1
			else:
				a = n // 3
				n = 0
	elif n == 3:
		a = 1
	arr = [str(a), str(b), str(c)]
	if int(a) > 0 or int(b) > 0 or int(c) > 0:
		print(' '.join(arr))
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	if n in (1, 2, 4):
		print(-1)
		continue
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	elif n % 3 == 2:
		print((n - 5) // 3, 1, 0)


t = int(input())
for i in range(t):
	k = int(input())
	if k in [1, 2, 4]:
		print(-1)
	elif k % 3 == 2:
		print((k - 5) // 3, 1, 0)
	elif k % 3 == 1:
		print((k - 7) // 3, 0, 1)
	else:
		print(k // 3, 0, 0)


import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	N = getInt()
	if N < 5 and N != 3:
		print(-1)
		return
	if N % 3 == 0:
		print(N // 3, 0, 0)
		return
	if N % 3 == 1:
		print((N - 7) // 3, 0, 1)
		return
	print((N - 5) // 3, 1, 0)
	return
for _ in range(getInt()):
	solve()


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(getint()):
		n = getint()
		(x, y) = divmod(n, 3)
		if y == 0:
			print(x, 0, 0)
		elif y == 1 and x >= 2:
			print(x - 2, 0, 1)
		elif y == 2 and x >= 1:
			print(x - 1, 1, 0)
		else:
			print(-1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def getint():
	return int(input())

def getints():
	return list(map(int, input().split()))

def getint1():
	return list(map(lambda x: int(x) - 1, input().split()))
main()


import sys
infile = sys.stdin
next(infile)
for line in infile:
	n = int(line)
	r = n % 3
	ans = [0, 0, 0]
	if r == 0:
		ans[0] = n // 3
		print(*ans)
	elif r == 1:
		if n // 3 >= 2:
			ans[0] = n // 3 - 2
			ans[2] = 1
			print(*ans)
		else:
			print(-1)
	elif n // 3 >= 1:
		ans[0] = n // 3 - 1
		ans[1] = 1
		print(*ans)
	else:
		print(-1)


for t in range(int(input())):
	n = int(input())
	if n == 4 or n < 3:
		print(-1)
	else:
		a = n % 3
		if a == 0:
			print(n // 3, 0, 0)
		elif a == 1:
			print((n - 7) // 3, 0, 1)
		else:
			print((n - 5) // 3, 1, 0)


t = int(input())
wrong = [1, 2, 4]
fives = list(range(5, 1001, 3))
sevens = list(range(7, 1001, 3))
for i in range(t):
	q = int(input())
	if q in wrong:
		print(-1)
	elif q in fives:
		print(fives.index(q), 1, 0)
	elif q in sevens:
		print(sevens.index(q), 0, 1)
	else:
		print(q // 3, 0, 0)


ans = [0] * 1001
ans[3] = [1, 0, 0]
ans[5] = [0, 1, 0]
ans[6] = [2, 0, 0]
ans[7] = [0, 0, 1]
for i in range(7, 1001):
	if ans[i - 3]:
		ans[i] = ans[i - 3].copy()
		ans[i][0] += 1
		continue
	if ans[i - 5]:
		ans[i] = ans[i - 5].copy()
		ans[i][1] += 1
		continue
	if ans[i - 7]:
		ans[i] = ans[i - 7].copy()
		ans[i][2] += 1
		continue
for i in range(int(input())):
	a = int(input())
	if ans[a]:
		print(*ans[a])
	else:
		print(-1)


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = int(input())
import collections
import heapq
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	(a, b, c) = (-1, -1, -1)
	ch = 0
	for i in range(n // 3 + 1):
		for j in range(n - i * 3 + 1):
			if j % 5 == 0 and (n - (i * 3 + j)) % 7 == 0:
				(a, b, c) = (i, j // 5, (n - (i * 3 + j)) // 7)
				ch = 1
	if ch == 1:
		print(a, b, c)
	else:
		print(-1)
for _ in range(t):
	n = int(input())
	solve()


test_case = int(input())
while test_case > 0:
	total = int(input())
	if total in [1, 2, 4]:
		print(-1)
	else:
		modulo = total % 3
		(a, b, c) = (0, 0, 0)
		if modulo == 0:
			a = total // 3
		elif modulo == 1:
			a = (total - 7) // 3
			c = 1
		else:
			a = (total - 5) // 3
			b = 1
		print(a, b, c)
	test_case -= 1


T = int(input())
for i in range(T):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1 and n >= 7:
		print((n - 7) // 3, 0, 1)
	elif n % 3 == 2 and n >= 5:
		print((n - 5) // 3, 1, 0)
	else:
		print(-1)


def solve(n, count):
	if n == 0:
		return True
	if n < 0:
		return False
	for (i, c) in enumerate([3, 5, 7]):
		count[i] += 1
		res = solve(n - c, count)
		if res:
			return res
		count[i] -= 1
	return False

def main(input_path=0):
	with open(input_path) as f:
		t = int(f.readline().strip())
		for _ in range(t):
			counter = [0] * 3
			res = solve(int(f.readline().strip()), counter)
			if res:
				print(' '.join((str(x) for x in counter)))
			else:
				print(-1)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 4 and n != 3:
		print(-1)
	elif n % 3 == 0:
		print(int(n / 3), 0, 0)
	elif n % 3 == 1:
		print(int(n / 3) - 2, 0, 1)
	else:
		print(int(n / 3) - 1, 1, 0)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def test():
	n = int(input())
	(t, f, s) = (0, 0, 0)
	if n == 1 or n == 2 or n == 4:
		return -1
	if n % 3 == 0:
		t = n // 3
		return f'{t} {f} {s}'
	elif n % 3 == 1:
		t = (n - 7) // 3
		s += 1
		return f'{t} {f} {s}'
	else:
		t = (n - 5) // 3
		f += 1
		return f'{t} {f} {s}'
t = int(input())
for _ in range(t):
	print(test())


n = 1000
arr = [[0, 0, 0] for x in range(n + 1)]
arr[3] = [1, 0, 0]
arr[5] = [0, 1, 0]
arr[7] = [0, 0, 1]
for x in range(3, n + 1):
	if any(arr[x - 3]):
		arr[x][0] = arr[x - 3][0] + 1
		arr[x][1] = arr[x - 3][1]
		arr[x][2] = arr[x - 3][2]
	elif any(arr[x - 5]):
		arr[x][0] = arr[x - 5][0]
		arr[x][1] = arr[x - 5][1] + 1
		arr[x][2] = arr[x - 5][2]
	elif any(arr[x - 7]):
		arr[x][0] = arr[x - 7][0]
		arr[x][1] = arr[x - 7][1]
		arr[x][2] = arr[x - 7][2] + 1
for t in range(int(input())):
	n = int(input())
	if any(arr[n]):
		print(*arr[n])
	else:
		print(-1)


import sys
input = sys.stdin.readline
ANS = [-1, -1, -1, (1, 0, 0), -1, (0, 1, 0), (2, 0, 0), (0, 0, 1), (1, 1, 0)]
for i in range(9, 1005):
	if ANS[i - 3] != -1:
		(x, y, z) = ANS[i - 3]
		ANS.append((x + 1, y, z))
	elif ANS[i - 5] != -1:
		(x, y, z) = ANS[i - 5]
		ANS.append((x, y + 1, z))
	elif ANS[i - 7] != -1:
		(x, y, z) = ANS[i - 7]
		ANS.append((x, y, z + 1))
t = int(input())
for tests in range(t):
	n = int(input())
	if ANS[n] == -1:
		print(-1)
	else:
		print(*ANS[n])


t = int(input())
w = []
for i in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		w.append([-1])
	else:
		if n % 3 == 0:
			w.append([n // 3, 0, 0])
		if n % 3 == 1:
			w.append([(n - 7) // 3, 0, 1])
		if n % 3 == 2:
			w.append([(n - 5) // 3, 1, 0])
for i in w:
	print(*i)


import sys
input = sys.stdin.readline
test = int(input())
for _ in range(test):
	n = int(input())
	if n == 1 or n == 4 or n == 2:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)


for _ in range(int(input())):
	n = int(input())
	a = n // 3
	if n in [1, 2, 4]:
		print(-1)
		continue
	rem = n % 3
	b = 0
	c = 0
	if rem == 1:
		a -= 2
		c = 1
	elif rem == 2:
		a -= 1
		b = 1
	print(a, b, c)


for tc in [0] * int(input()):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(int(n / 3), 0, 0)
	elif (n - 5) % 3 == 0:
		print(int((n - 5) / 3), 1, 0)
	else:
		print(int((n - 7) / 3), 0, 1)


t = int(input())

def is_solved(n, ans):
	if sum(ans) == n:
		return True
	else:
		return False

def valid(n, ans, num):
	if sum(ans) + num <= n:
		return True
	else:
		return False

def solve(n, ans):
	arr = [3, 5, 7]
	if is_solved(n, ans) == True:
		return True
	else:
		for i in range(3):
			if valid(n, ans, arr[i]):
				ans.append(arr[i])
				if solve(n, ans) == True:
					return True
				else:
					ans.pop()
					pass
		else:
			return False
while t > 0:
	t -= 1
	n = int(input())
	ans = []
	solve(n, ans)
	if sum(ans) == 0:
		print('-1')
	else:
		(r3, r5, r7) = (0, 0, 0)
		for item in ans:
			if item == 3:
				r3 += 1
			elif item == 5:
				r5 += 1
			elif item == 7:
				r7 += 1
		print(r3, r5, r7)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print('-1')
	else:
		(q, r) = divmod(n, 3)
		if r == 0:
			print(q, 0, 0)
		elif r == 1:
			if n == 4:
				print('-1')
			else:
				print(q - 2, 0, 1)
		else:
			print(q - 1, 1, 0)


import sys
from math import factorial as fact

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))
for _ in range(iinput()):
	n = iinput()
	if n in [1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	else:
		print((n - 7) // 3, 0, 1)


for test in range(int(input())):
	n = int(input())
	if n < 3:
		print(-1)
	elif n == 4:
		print(-1)
	elif n % 3 == 0:
		print(str(int(n // 3)) + ' 0 0')
	elif n % 3 == 2:
		print(str((n - 3) // 3) + ' 1 0')
	else:
		print(str((n - 6) // 3) + ' 0 1')


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')

def window_count(windows):
	if windows >= 7:
		if windows % 3 == 0:
			print(str(int(windows / 3)) + ' 0 0')
			return
		elif windows % 3 == 1:
			print(str(int(windows // 3) - 2) + ' 0 ' + '1')
			return
		elif windows % 3 == 2:
			print(str(int(windows // 3) - 1) + ' 1 0')
			return
	elif windows % 3 == 0:
		print(str(int(windows / 3)) + ' 0 0')
		return
	elif windows == 5:
		print('0 1 0')
		return
	else:
		print('-1')
		return
num_tests = int(input().strip())
for _ in range(num_tests):
	num_windows = int(input())
	window_count(num_windows)


def ii():
	return int(input())
for _ in range(int(input())):
	n = ii()
	if n in [1, 2, 4]:
		print('-1')
		continue
	(x, a) = (n // 3, n % 3)
	r = [f'{x} 0 0', f'{x - 2} 0 1', f'{x - 1} 1 0']
	print(r[a])


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
for _ in range(int(input())):
	n = int(input())
	a = n // 3
	n %= 3
	if n == 2:
		print([-1, str(a - 1) + ' ' + str(1) + ' ' + str(0)][a >= 1])
	elif n == 1:
		print([-1, str(a - 2) + ' ' + str(0) + ' ' + str(1)][a >= 2])
	else:
		print(a, 0, 0)


def solve(n):
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)
T = int(input())
for t in range(T):
	n = int(input())
	solve(n)


n = int(input())
b = []
for i in range(n):
	b.append(int(input()))
black_list = [1, 2, 4]
for i in range(n):
	if b[i] in black_list:
		print(-1)
	if b[i] % 3 == 0 and b[i] not in black_list:
		print(b[i] // 3, 0, 0)
	if b[i] % 3 == 1 and b[i] not in black_list:
		print((b[i] - 7) // 3, 0, 1)
	if b[i] % 3 == 2 and b[i] not in black_list:
		print((b[i] - 5) // 3, 1, 0)


import math
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(100000)

def put():
	return map(int, stdin.readline().split())
for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		if n // 3 >= 2:
			print(n // 3 - 2, 0, 1)
		else:
			print(-1)
	elif n // 3 >= 1:
		print(n // 3 - 1, 1, 0)
	else:
		print(-1)


def solve(n):
	m = n // 3
	(f, s) = (0, 0)
	while True:
		r = n - 3 * m
		if r % 5 == 0:
			f = int(r / 5)
			break
		elif r % 7 == 0:
			s = int(r / 7)
			break
		else:
			m -= 1
		if m == -1:
			return -1
	return ' '.join(list(map(str, [m, f, s])))
t = int(input())
for _ in range(1, t + 1):
	n = int(input())
	print(solve(n))


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	c = int(n / 3)
	o = n % 3
	if o == 0:
		print(c, 0, 0)
	elif o == 1 and c >= 2:
		print(c - 2, 0, 1)
	elif o == 2 and c >= 1:
		print(c - 1, 1, 0)
	else:
		print(-1)


from itertools import combinations

class Solution:

	def __init__(self):
		self.found = -1
		self.pattern = []
		self.three = 0
		self.five = 0
		self.seven = 0

	def roomsType(self, number):
		arr = []
		self.roomPossible(arr, number)
		if self.found == -1:
			print(-1)
			return -1
		result = []
		for val in [3, 5, 7]:
			temp_val = self.pattern.count(val)
			result.append(temp_val)
		print(*result)

	def roomPossible(self, arr, number):
		if self.found == 1:
			return
		if number == 0:
			self.found = 1
			self.pattern = arr.copy()
			return
		if number < 0:
			return
		for num in [3, 5, 7]:
			arr.append(num)
			self.roomPossible(arr, number - num)
			del arr[-1]
num = int(input())
while num:
	sol = Solution()
	window = int(input())
	sol.roomsType(window)
	num -= 1


import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
	n = int(sys.stdin.readline().strip())
	(n3, n5, n7) = (0, 0, 0)
	if n >= 5:
		n3 = (n - 5) // 3
		n = n - 3 * n3
	if n == 7:
		n7 = n7 + 1
	elif n == 6:
		n3 = n3 + 2
	elif n == 5:
		n5 = n5 + 1
	elif n == 4:
		n3 = -1
	elif n == 3:
		n3 = n3 + 1
	elif n == 2:
		n3 = -1
	elif n == 1:
		n3 = -1
	if n3 == -1:
		print(-1)
	else:
		print(n3, n5, n7)


t = int(input())
for k in range(t):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1 and n >= 7:
		print((n - 7) // 3, 0, 1)
	elif n % 3 == 2 and n >= 5:
		print((n - 5) // 3, 1, 0)
	else:
		print(-1)


for k in range(int(input())):
	threes = fives = sevens = 0
	w = int(input())
	if w % 3 == 1:
		w -= 7
		sevens += 1
	elif w % 3 == 2:
		w -= 5
		fives += 1
	threes = w // 3
	if threes >= 0 and fives >= 0 and (sevens >= 0):
		print(threes, fives, sevens)
	else:
		print(-1)


for pratyush in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 2:
		print((n - 5) // 3, 1, 0)
	else:
		print((n - 7) // 3, 0, 1)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	if n in [1, 2, 4]:
		print(-1)
		continue
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	else:
		print((n - 7) // 3, 0, 1)


t = int(input())
s = ''
for i in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		s += '-1\n'
	elif n % 3 == 0:
		s += str(n // 3) + ' 0 0\n'
	elif n % 3 == 1:
		s += str((n - 7) // 3) + ' 0 1\n'
	elif n % 3 == 2:
		s += str((n - 5) // 3) + ' 1 0\n'
print(s)


import sys, collections, math, itertools
INF = sys.maxsize

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	else:
		print(n // 3 - 1, 1, 0)


test = int(input())
while test:
	test -= 1
	n = int(input())
	max3 = n // 3
	(threes, fives, sevens) = (0, 0, 0)
	for t in range(0, max3 + 1):
		max5 = (n - t * 3) // 5
		for f in range(0, max5 + 1):
			if (n - t * 3 - f * 5) % 7 == 0 and n - t * 3 - f * 5 >= 0:
				s = (n - t * 3 - f * 5) // 7
				(threes, fives, sevens) = (t, f, s)
				break
	if threes or fives or sevens:
		print(threes, fives, sevens)
	else:
		print(-1)


def search(k):
	if k == 1 or k == 2 or k == 4:
		return [-1]
	if k % 3 == 0:
		return (k // 3, 0, 0)
	elif k % 3 == 1:
		return ((k - 7) // 3, 0, 1)
	else:
		return ((k - 5) // 3, 1, 0)
for _ in range(int(input())):
	n = int(input())
	print(*search(n))


import math
import time
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import PriorityQueue
import sys
t = int(stdin.readline())
ans = defaultdict(lambda : [0, 0, 0])
ans[3] = [1, 0, 0]
ans[5] = [0, 1, 0]
ans[6] = [2, 0, 0]
ans[7] = [0, 0, 1]
for i in range(8, 1001):
	if ans[i - 3] != [0, 0, 0]:
		ans[i] = ans[i - 3][:]
		ans[i][0] += 1
	elif ans[i - 5] != [0, 0, 0]:
		ans[i] = ans[i - 5][:]
		ans[i][1] += 1
	elif ans[i - 7] != [0, 0, 0]:
		ans[i] = ans[i - 7][:]
		ans[i][2] += 1
for _ in range(t):
	n = int(stdin.readline())
	if ans[n] == [0, 0, 0]:
		print(-1)
	else:
		print(*ans[n])


for i in range(int(input())):
	n = int(input())
	t = 0
	f = 0
	s = 0
	if n % 3 == 0:
		t = n // 3
		print(t, f, s)
	elif n % 3 == 1 and n // 3 == 1 or n // 3 == 0:
		print(-1)
	elif n % 3 == 2:
		t = n // 3 - 1
		f = 1
		print(t, f, s)
	elif n % 3 == 1:
		t = n // 3 - 2
		s = 1
		print(t, f, s)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		if n % 3 == 0:
			r = [n // 3, 0, 0]
		elif n % 3 == 1 and n >= 7:
			r = [(n - 7) // 3, 0, 1]
		elif n % 3 == 2 and n >= 5:
			r = [(n - 5) // 3, 1, 0]
		else:
			r = [-1]
		rr.append(JA(r, ' '))
	return JA(rr, '\n')
print(main())


rw = int(input())
for wewq in range(rw):
	n = int(input())
	a = 0
	b = 0
	c = 0
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		if n // 3 - 2 < 0:
			print(-1)
			continue
		print(n // 3 - 2, 0, 1)
	elif n % 3 == 2:
		if n // 3 - 1 < 0:
			print(-1)
			continue
		print(n // 3 - 1, 1, 0)


t = int(input())
for you in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
		continue
	if n == 3:
		print(1, 0, 0)
		continue
	z = n % 3
	if z == 0:
		print(n // 3, 0, 0)
	if z == 1:
		print((n - 7) // 3, 0, 1)
	if z == 2:
		print((n - 5) // 3, 1, 0)


import sys, os, io
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
ans = [[0, 0, 0]]
vs = [3, 5, 7]
for i in range(1, 1001):
	for v in vs:
		if i >= v and len(ans[i - v]) > 0:
			l = ans[i - v][:]
			l[vs.index(v)] += 1
			ans.append(l)
			break
	else:
		ans.append([])
for tc in range(1, 1 + int(I())):
	n = int(I())
	if len(ans[n]) > 0:
		print(*ans[n])
	else:
		print(-1)


b = int(input())
for i in range(b):
	a = int(input())
	if a == 1 or a == 2 or a == 4:
		print(-1)
	elif a == 7:
		print(0, 0, 1)
	elif not a % 3:
		print(a // 3, 0, 0)
	elif a % 3 == 2:
		print(a // 3 - 1, 1, 0)
	else:
		print(a // 3 - 2, 0, 1)


m = [[-1, -1, -1]] * 1001
m[3] = [1, 0, 0]
m[5] = [0, 1, 0]
m[6] = [2, 0, 0]
m[7] = [0, 0, 1]
for i in range(8, 1001):
	if m[i - 3][0] != -1:
		m[i] = [m[i - 3][0] + 1, m[i - 3][1], m[i - 3][2]]
	elif m[i - 5][0] != -1:
		m[i] = [m[i - 5][0], m[i - 5][1] + 1, m[i - 5][2]]
	elif m[i - 7][0] != -1:
		m[i] = [m[i - 7][0], m[i - 7][1], m[i - 7][2] + 1]
for _ in range(int(input())):
	n = int(input())
	if m[n][0] == -1:
		print(-1)
	else:
		print(' '.join(map(str, m[n])))


def f(n):
	if n == 1 or n == 2 or n == 4:
		return [-1]
	elif n % 3 == 0:
		return [int(n / 3), 0, 0]
	elif n % 3 == 1:
		return [int((n - 7) / 3), 0, 1]
	else:
		return [int((n - 5) / 3), 1, 0]
n = int(input())
for i in range(n):
	x = int(input())
	print(*f(x))


from bisect import *
from math import *
from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))

def solve():
	n = I()
	if n == 1 or n == 4 or n == 2:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)
for _ in range(I()):
	solve()


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(str(n // 3) + ' ' + str(0) + ' ' + str(0))
	elif n % 3 == 1:
		k = n // 3 - 2
		if k >= 0:
			print(str(k) + ' ' + str(0) + ' ' + str(1))
		else:
			print(-1)
	else:
		k = n // 3 - 1
		if k >= 0:
			print(str(k) + ' ' + str(1) + ' ' + str(0))
		else:
			print(-1)


for _ in range(int(input())):
	a = int(input())
	b = a % 3
	x = a // 3
	y = 0
	z = 0
	if a != 0 and b == 0:
		print(x, y, z)
	elif b == 1 and a > 6:
		x = x - 2
		z = 1
		print(x, y, z)
	elif b == 2 and a > 4:
		x = x - 1
		y = 1
		print(x, y, z)
	else:
		print(-1)


def testcase():
	global count, three, five, seven
	n = int(input())
	if count[n]:
		print(three[n], five[n], seven[n])
	else:
		print(-1)
	return
l = 1001
count = [False for _ in range(l)]
three = [0 for _ in range(l)]
five = [0 for _ in range(l)]
seven = [0 for _ in range(l)]
count[3] = True
count[5] = True
count[7] = True
three[3] = 1
five[5] = 1
seven[7] = 1
for i in range(3, l):
	if count[i]:
		if i + 3 < l:
			count[i + 3] = True
			three[i + 3] = three[i] + 1
			five[i + 3] = five[i]
			seven[i + 3] = seven[i]
		if i + 5 < l:
			count[i + 5] = True
			three[i + 5] = three[i]
			five[i + 5] = five[i] + 1
			seven[i + 5] = seven[i]
		if i + 7 < l:
			count[i + 7] = True
			three[i + 7] = three[i]
			five[i + 7] = five[i]
			seven[i + 7] = seven[i] + 1
t = int(input())
for _ in range(t):
	testcase()


cases = int(input())
for t in range(cases):
	n = int(input())
	v1 = n // 3
	v2 = 0
	v3 = 0
	left = n % 3
	if left == 0:
		print(v1, v2, v3)
	elif left == 1 and n > 6:
		v3 = 1
		v1 -= 2
		print(v1, v2, v3)
	elif left == 2 and n > 4:
		v2 = 1
		v1 -= 1
		print(v1, v2, v3)
	else:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	p = n % 3
	r = n // 3
	if p == 0:
		print(r, 0, 0)
	elif p == 1:
		if n == 1:
			print(-1)
		elif n == 4:
			print(-1)
		else:
			print(r - 2, 0, 1)
	elif p == 2:
		if n == 2:
			print(-1)
		else:
			print(r - 1, 1, 0)


t = int(input())
vals = [None] * 1008
vals[0] = (0, 0, 0)
for i in range(1001):
	if vals[i] is not None:
		(a, b, c) = vals[i]
		vals[i + 3] = (a + 1, b, c)
		vals[i + 5] = (a, b + 1, c)
		vals[i + 7] = (a, b, c + 1)
for _ in range(t):
	n = int(input())
	if vals[n] is None:
		print(-1)
	else:
		print(*vals[n])


for i in range(int(input())):
	n = int(input())
	ost = n % 3
	if ost == 1:
		k = n // 3
		k -= 2
		if k > 0:
			print(k, 0, 1)
		elif n % 7 == 0:
			print(0, 0, n // 7)
		elif n % 5 == 0:
			print(0, n // 5, 0)
		else:
			print(-1)
	elif ost == 2:
		k = n // 3
		k -= 1
		if k > 0:
			print(k, 1, 0)
		elif n % 7 == 0:
			print(0, 0, n // 7)
		elif n % 5 == 0:
			print(0, n // 5, 0)
		else:
			print(-1)
	elif ost == 0:
		k = n // 3
		print(k, 0, 0)


import sys

def combine(a, b):
	return map(sum, zip(a, b))

def solve(num_windows):
	if num_windows < 3:
		return -1
	elif num_windows == 3:
		return (1, 0, 0)
	elif num_windows == 5:
		return (0, 1, 0)
	elif num_windows == 7:
		return (0, 0, 1)
	three = solve(num_windows - 3)
	if three != -1:
		return combine((1, 0, 0), three)
	five = solve(num_windows - 5)
	if five != -1:
		return combine((0, 1, 0), five)
	seven = solve(num_windows - 7)
	if seven != -1:
		return combine((0, 0, 1), seven)
	return -1
_ = sys.stdin.readline()
for line in sys.stdin.readlines():
	a = solve(int(line))
	if a == -1:
		print(a)
	else:
		(a, b, c) = a
		print(a, b, c)


import sys, math
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	ans = [0, 0, 0]
	if n <= 1 or n == 2 or n == 4:
		print(-1)
	else:
		if n % 3 == 0:
			print(n // 3, 0, 0)
		if (n - 5) % 3 == 0:
			print((n - 5) // 3, 1, 0)
		if (n - 7) % 3 == 0:
			print((n - 7) // 3, 0, 1)


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop, nsmallest
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)

def setBitNumber(n):
	n |= n >> 1
	n |= n >> 2
	n |= n >> 4
	n |= n >> 8
	n |= n >> 16
	n = n + 1
	return n >> 1

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count
for _ in range(ii()):
	n = ii()
	x = n % 3
	if x == 0:
		print(n // 3, 0, 0)
	elif x == 1:
		if n // 3 == 0:
			print(-1)
		elif n // 3 == 1:
			print(-1)
		elif n // 3 == 2:
			print(0, 0, n // 7)
		else:
			print(n // 3 - 2, 0, 1)
	elif n % 3 == 2:
		if n // 3 == 0:
			print(-1)
		elif n // 3 == 1:
			print(0, 1, 0)
		else:
			print(n // 3 - 1, 1, 0)


a = [-1, -1, -1, (1, 0, 0), -1, (0, 1, 0), (2, 0, 0), (0, 0, 1)]
for i in range(8, 1001):
	if type(a[i - 3]) == tuple:
		a.append((a[i - 3][0] + 1, a[i - 3][1], a[i - 3][2]))
	elif type(a[i - 5]) == tuple:
		a.append((a[i - 5][0], a[i - 5][1] + 1, a[i - 5][2]))
	elif type(a[i - 7]) == tuple:
		a.append((a[i - 7][0], a[i - 7][1], a[i - 7][2] + 1))
	else:
		a.append(-1)
for _ in range(int(input())):
	n = int(input())
	if a[n] == -1:
		print(-1)
	else:
		print(*a[n])


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.buffer.readline
	for _ in range(int(input())):
		N = int(input())
		if N == 1 or N == 2 or N == 4:
			print(-1)
		elif N % 3 == 1:
			print((N - 7) // 3, 0, 1)
		elif N % 3 == 2:
			print((N - 5) // 3, 1, 0)
		else:
			print(N // 3, 0, 0)
main()


def calc(num):
	if num == 1 or num == 2 or num == 4:
		print('-1')
		return
	if num % 3 == 0:
		print(str(int(num / 3)) + ' 0' + ' 0')
	elif num % 3 == 1:
		print(str(int((num - 7) / 3)) + ' 0' + ' 1')
	else:
		print(str(int((num - 5) / 3)) + ' 1' + ' 0')
n = int(input())
numbers = []
for i in range(n):
	numbers.append(int(input()))
for num in numbers:
	calc(num)


t = int(input())
ans = {3: [1, 0, 0], 5: [0, 1, 0], 7: [0, 0, 1]}
i = 1
while i <= 1000:
	temp = None
	if i not in ans:
		ans[i] = -1
	else:
		temp = ans[i]
		ans[i + 3] = [temp[0] + 1, temp[1], temp[2]]
		ans[i + 5] = [temp[0], temp[1] + 1, temp[2]]
		ans[i + 7] = [temp[0], temp[1], temp[2] + 1]
	i += 1
for _ in range(t):
	n = int(input())
	if ans[n] == -1:
		print(-1)
	else:
		print(*ans[n], sep=' ')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	if n < 5:
		if n == 3:
			print('1 0 0')
		else:
			print(-1)
	elif n % 3 == 0:
		print(int(n / 3), 0, 0)
	elif n % 3 == 2:
		print(int(n / 3) - 1, 1, 0)
	else:
		print(int(n / 3) - 2, 0, 1)


dp = [False] * 1001
dp[0] = True
split = {0: {0: 0, 1: 0, 2: 0}}
for i in range(1, 1001):
	split[i] = {0: 0, 1: 0, 2: 0}
	if i - 3 >= 0 and dp[i - 3] == True:
		dp[i] = True
		(split[i][0], split[i][1], split[i][2]) = (split[i - 3][0] + 1, split[i - 3][1], split[i - 3][2])
	elif i - 5 >= 0 and dp[i - 5] == True:
		dp[i] = True
		(split[i][0], split[i][1], split[i][2]) = (split[i - 5][0], split[i - 5][1] + 1, split[i - 5][2])
	elif i - 7 >= 0 and dp[i - 7] == True:
		dp[i] = True
		(split[i][0], split[i][1], split[i][2]) = (split[i - 7][0], split[i - 7][1], 1 + split[i - 7][2])
t = int(input())
for i in range(t):
	n = int(input())
	if dp[n] == False:
		print(-1)
	else:
		temp = [split[n][0], split[n][1], split[n][2]]
		print(*temp)


import sys
import math
import itertools
import copy
input = sys.stdin.readline
dp = [[0, 0, 0] for i in range(1002)]
coins = [3, 5, 7]
can = [False] * 1002
(can[3], can[5], can[6], can[7]) = (True, True, True, True)
(dp[3], dp[5], dp[6], dp[7]) = ([1, 0, 0], [0, 1, 0], [2, 0, 0], [0, 0, 1])
for i in range(7, 1002):
	for x in coins:
		if can[i - x] and (not can[i]):
			can[i] = True
			dp[i] = copy.deepcopy(dp[i - x])
			if x == 3:
				dp[i][0] += 1
			elif x == 5:
				dp[i][1] += 1
			else:
				dp[i][2] += 1
			break
ttt = int(input())
for tt in range(ttt):
	n = int(input())
	if can[n]:
		print(*dp[n])
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = (0, 1, 2, 4)
	if n in a:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0, sep=' ')
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0, sep=' ')
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1, sep=' ')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	if n == 1:
		print(-1)
		continue
	elif n == 2:
		print(-1)
		continue
	elif n == 4:
		print(-1)
		continue
	a = n // 3
	b = 0
	c = 0
	if n % 3 == 1:
		a -= 2
		c += 1
	elif n % 3 == 2:
		a -= 1
		b += 1
	print(a, b, c)


def get(n):
	div = n // 3
	rem = n % 3
	if rem == 2:
		if div == 0:
			print(-1)
		else:
			print(div - 1, 1, 0)
	if rem == 0:
		print(div, 0, 0)
	if rem == 1:
		if div < 2:
			print(-1)
		else:
			print(div - 2, 0, 1)
T = int(input())
for t in range(T):
	n = int(input())
	get(n)


def solution(n):
	if n in [1, 2, 4]:
		return (0, [])
	a = n // 3
	b = n % 3
	p = a
	q = 0
	r = 0
	if b == 2:
		p = a - 1
		q = 1
		r = 0
	elif b == 1:
		p = a - 2
		q = 0
		r = 1
	return (1, [p, q, r])
for _ in range(int(input())):
	n = int(input())
	(cond, ans) = solution(n)
	if cond:
		print(*ans)
	else:
		print(-1)


import sys
lines = sys.stdin.readlines()
cur_line = -1

def input():
	global lines, cur_line
	cur_line += 1
	return lines[cur_line][:-1]
pos = [False] * 1001
pos[0] = True
for i in range(1, 1001):
	for d in [3, 5, 7]:
		if i >= d and pos[i - d]:
			pos[i] = True

def solve():
	n = int(input())
	if not pos[n]:
		print(-1)
		return
	ks = [0, 0, 0]
	ds = [3, 5, 7]
	while n > 0:
		for i in range(3):
			if ds[i] <= n and pos[n - ds[i]]:
				n -= ds[i]
				ks[i] += 1
				break
	print(*ks)
for _ in range(int(input())):
	solve()


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n in [0, 1, 2, 4]:
		print(-1)
		continue
	t = n // 3
	if n % 3 == 0:
		print(t, 0, 0)
	elif n % 3 == 1:
		print(t - 2, 0, 1)
	else:
		print(t - 1, 1, 0)


tc = int(input())
for tcc in range(1, tc + 1):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		k = n // 3
		print(k, 0, 0)
	elif n % 3 == 1:
		k = n // 3 - 2
		print(k, 0, 1)
	elif n % 3 == 2:
		k = n // 3 - 1
		print(k, 1, 0)


import math
t = int(input())
for q in range(t):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1 and n > 4:
		print((n - 7) // 3, 0, 1)
	elif n % 3 == 2 and n > 2:
		print((n - 5) // 3, 1, 0)
	else:
		print(-1)


t = int(input())
while t:
	n = int(input())
	re = n % 3
	k = n // 3
	if re == 2:
		k -= 1
		if k < 0:
			print(-1)
		else:
			print(k, 1, 0)
	elif re == 1:
		k -= 2
		if k < 0:
			print(-1)
		else:
			print(k, 0, 1)
	else:
		print(k, 0, 0)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	th = 0
	fi = 0
	sv = 0
	f = 0
	if n % 3 == 0:
		th = n // 3
	elif n % 3 == 1:
		th = n // 3 - 2
		if th < 0:
			f = 1
		sv = 1
	else:
		th = n // 3 - 1
		if th < 0:
			f = 1
		fi = 1
	if f == 1:
		print(-1)
	else:
		print(th, fi, sv)


def sol(n):
	if n == 1 or n == 2 or n == 4 or (n < 0):
		return -1
	if n % 3 == 0:
		return f'{n // 3} 0 0'
	elif (n + 1) % 3 == 0:
		return f'{(n - 5) // 3} 1 0'
	elif (n + 2) % 3 == 0:
		return f'{(n - 7) // 3} 0 1'
t = int(input())
while t:
	n = int(input())
	print(sol(n))
	t = t - 1


for z in range(int(input())):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
	else:
		three = five = seven = 0
		if n % 3 == 0:
			three = n // 3
		elif n % 3 == 1:
			seven = 1
			three = (n - 7) // 3
		else:
			five = 1
			three = (n - 5) // 3
		print(three, five, seven)


t = int(input())
for case in range(1, t + 1):
	n = int(input())
	solvable = [-1] * (n + 1)

	def solve(b):
		if b < 0:
			return 0
		if b == 0:
			return 1
		if solvable[b] != -1:
			return solvable[b]
		if solve(b - 3) > 0:
			solvable[b] = 3
		elif solve(b - 5) > 0:
			solvable[b] = 5
		elif solve(b - 7) > 0:
			solvable[b] = 7
		else:
			solvable[b] = 0
		return solvable[b]
	res = solve(n)
	if res == 0:
		print(-1)
	else:
		elements = {3: 0, 5: 0, 7: 0}
		index = n
		while index > 0:
			elements[solvable[index]] += 1
			index -= solvable[index]
		print(elements[3], elements[5], elements[7])


def ans(n):
	if n % 3 == 0:
		print(str(n // 3) + ' 0' + ' 0')
	elif n % 3 == 1:
		if n == 4 or n == 1:
			print(-1)
		else:
			print(str(n // 3 - 2) + ' 0' + ' 1')
	elif n == 2:
		print(-1)
	else:
		print(str(n // 3 - 1) + ' 1' + ' 0')
	return
m = int(input())
for j in range(m):
	n = int(input())
	ans(n)


t = int(input())
for i in range(t):
	n = int(input())
	m = n % 3
	d = n // 3
	if n in [1, 2, 4]:
		print(-1)
	elif m == 2:
		print(d - 1, '1 0')
	elif m == 1:
		print(d - 2, '0 1')
	else:
		print(d, '0 0')


def window(num):
	if num in [1, 2, 4]:
		print(-1)
	elif num % 3 == 0:
		print(num // 3, 0, 0)
	elif num % 3 == 1:
		print((num - 7) // 3, 0, 1)
	elif num % 3 == 2:
		print((num - 5) // 3, 1, 0)
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for i in a:
	window(i)


def flat(n):
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	elif (n - 7) % 3 == 0:
		print((n - 7) // 3, 0, 1)
	else:
		print(n // 3, 0, 0)
k = int(input())
for i in range(k):
	n = int(input())
	flat(n)


for t in range(int(input())):
	n = int(input())
	x = n % 3
	y = n // 3
	if x == 0:
		print(y, 0, 0)
	elif x == 2 and y >= 1:
		print(y - 1, 1, 0)
	elif x == 1 and y >= 2:
		print(y - 2, 0, 1)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	r = n % 3
	x = 0
	y = 0
	z = 0
	if r == 0:
		x = n // 3
	elif r == 2 and n >= 5:
		y += 1
		x = (n - 5) // 3
	elif r == 1 and n >= 7:
		z += 1
		x = (n - 7) // 3
	else:
		x = -1
	if x == -1:
		print(-1)
	else:
		print(x, y, z)


from collections import Counter
t = int(input().strip())
q = []
for _ in range(t):
	inp = int(input().strip())
	q.append(inp)
pos = [False] * 1001
pos[3] = True
pos[5] = True
pos[6] = True
pos[7] = True
for i in range(8, len(pos)):
	if any((pos[i - 3], pos[i - 5], pos[i - 7])):
		pos[i] = True
for qu in q:
	if not pos[qu]:
		print(-1)
		continue
	answer = []
	i = qu
	while True:
		if i in set((3, 5, 7)):
			answer.append(i)
			break
		for j in (3, 5, 7):
			if pos[max(i - j, 0)]:
				answer.append(j)
				break
		i -= j
	result = Counter(answer)
	print(' '.join(map(str, (result[3], result[5], result[7]))))


for s in [*open(0)][1::1]:
	n = int(s.strip())
	if n in [1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)


t = int(input())
for case in range(t):
	n = int(input())
	if n in [1, 2, 4]:
		ans = [-1]
	elif n % 3 == 0:
		ans = [n // 3, 0, 0]
	elif n % 3 == 1:
		ans = [(n - 7) // 3, 0, 1]
	elif n % 3 == 2:
		ans = [(n - 5) // 3, 1, 0]
	print(*ans)


x = int(input())
for z in range(x):
	n = int(input())
	if n < 5 and n != 3:
		print(-1)
	else:
		c = n % 3
		if c == 0:
			print(n // 3, 0, 0)
		elif c == 1:
			print(n // 3 - 2, 0, 1)
		else:
			print(n // 3 - 1, 1, 0)


ans = [[] for _ in range(1010)]
ans[0] = (0, 0, 0)
for i in range(1001):
	if not ans[i]:
		continue
	(a, b, c) = ans[i]
	ans[i + 3] = (a + 1, b, c)
	ans[i + 5] = (a, b + 1, c)
	ans[i + 7] = (a, b, c + 1)
for _ in range(int(input())):
	n = int(input())
	a = ans[n]
	if a:
		print(' '.join(map(str, ans[n])))
	else:
		print(-1)


T = int(input())
for _ in range(T):
	n = int(input())
	val = n % 3
	cnt = n // 3
	if val == 0:
		print(cnt, 0, 0)
	elif val == 1:
		if cnt < 2:
			print(-1)
		else:
			print(cnt - 2, 0, 1)
	elif cnt < 1:
		print(-1)
	else:
		print(cnt - 1, 1, 0)


T = int(input())
for t in range(T):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	else:
		x = n // 3
		rem = n % 3
		if rem == 0:
			print(x, 0, 0)
		elif rem == 1:
			print(x - 2, 0, 1)
		else:
			print(x - 1, 1, 0)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	(num3, num5, num7) = (n // 3, 0, 0)
	if n < 5 and n != 3:
		print(-1)
		continue
	if n % 3 == 1:
		num7 += 1
		num3 -= 2
	if n % 3 == 2:
		num5 += 1
		num3 -= 1
	print(num3, num5, num7)


t = int(input())
for i in range(t):
	n = int(input())
	three = five = seven = 0
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		if n % 3 == 0:
			three = n // 3
		elif (n - 7) % 3 == 0:
			seven = 1
			three = (n - 7) // 3
		elif (n - 5) % 3 == 0:
			five = 1
			three = (n - 5) // 3
		elif (n - 13) % 3 == 0:
			seven = 1
			five = 1
			three = (n - 13) // 3
		print(three, five, seven)


def find(N):
	if N < 3 or N == 4:
		print(-1)
		return
	L = N % 3
	if L == 0:
		print(N // 3, 0, 0)
	if L == 1:
		print(N // 3 - 2, 0, 1)
	if L == 2:
		print(N // 3 - 1, 1, 0)

def main():
	for _ in range(int(input())):
		N = int(input())
		find(N)
main()


def solve(n, c1, c2, c3, ans):
	if n == 0:
		(ans[0], ans[1], ans[2]) = (c1, c2, c3)
		return
	if n < 0:
		return
	solve(n - 3, c1 + 1, c2, c3, ans)
	for i in ans:
		if i != 0:
			return
	solve(n - 5, c1, c2 + 1, c3, ans)
	for i in ans:
		if i != 0:
			return
	solve(n - 7, c1, c2, c3 + 1, ans)
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	ans = [0, 0, 0]
	solve(n, 0, 0, 0, ans)
	for i in ans:
		if i != 0:
			print(*ans)
			break
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	a = b = c = 0
	a = n // 3
	r = n % 3
	if r == 0:
		print(a, b, c)
	elif r == 1:
		if a < 2:
			print(-1)
		else:
			a = a - 2
			c += 1
			print(a, b, c)
	elif a < 1:
		print(-1)
	else:
		a = a - 1
		b += 1
		print(a, b, c)


import sys
t = int(input())
while t > 0:
	t -= 1
	n = int(sys.stdin.readline())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)


for test in range(int(input())):
	n = int(input())
	(x, y, z) = (-1, -1, -1)
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			k = n - 3 * i - 5 * j
			if k >= 0:
				if k % 7 == 0:
					(x, y, z) = (i, j, k // 7)
	if x != -1:
		print(x, y, z)
	else:
		print(-1)


tim = int(input())
for i in range(0, tim):
	num = int(input())
	if 1 <= num <= 1000:
		if num == 1 or num == 2 or num == 4:
			print(-1)
		elif num % 3 == 0:
			print(num // 3, 0, 0)
		elif num % 3 == 1:
			print((num - 7) // 3, 0, 1)
		else:
			print((num - 5) // 3, 1, 0)


def solve():
	n = int(input())
	k = n // 3
	if k > 0 and n % 3 == 2:
		k -= 1
		print(k, 1, 0)
	elif k > 1 and n % 3 == 1:
		k -= 2
		print(k, 0, 1)
	elif n % 3 == 0:
		print(k, 0, 0)
	else:
		print(-1)

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	else:
		print(n // 3, 0, 0)


def ans(x):
	if x == 1 or x == 2 or x == 4:
		print(-1)
	elif x % 3 == 0:
		print(x // 3, 0, 0)
	elif x % 3 == 1:
		print((x - 7) // 3, 0, 1)
	elif x % 3 == 2:
		print((x - 5) // 3, 1, 0)
t = int(input())
for i in range(t):
	ans(int(input()))


def help(a, b, c, n):
	global a1, b1, c1, flag
	if a * 3 + b * 5 + c * 7 == n:
		flag = 1
		(a1, b1, c1) = (a, b, c)
		return
	if a * 3 + b * 5 + c * 7 > n:
		return
	if not flag:
		help(a + 1, b, c, n)
		help(a, b + 1, c, n)
		help(a, b, c + 1, n)
for _ in range(int(input())):
	n = int(input())
	a1 = 0
	b1 = 0
	c1 = 0
	flag = 0
	if n < 3 or n == 4:
		print(-1)
	else:
		help(0, 0, 0, n)
		if flag:
			print(a1, b1, c1)
		else:
			print(-1)


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	else:
		print((n - 7) // 3, 0, 1)


from __future__ import division, print_function
import bisect
import math
import heapq
import itertools
import sys
from collections import deque
from atexit import register
from collections import Counter
from functools import reduce
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
if sys.version_info[0] < 3:

	class dict(dict):

		def items(self):
			return dict.iteritems(self)

		def keys(self):
			return dict.iterkeys(self)

		def values(self):
			return dict.itervalues(self)
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def sync_with_stdio(sync=True):
	global input, flush
	if sync:
		flush = sys.stdout.flush
	else:
		sys.stdin = stream(sys.stdin.read())
		input = lambda : sys.stdin.readline().rstrip('\r\n')
		sys.stdout = stream()
		register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

def main():
	for _ in range(int(input())):
		n = int(input())
		k = n // 3
		a = n % 3
		if a == 1:
			if k >= 2:
				print(k - 2, 0, 1)
			else:
				print('-1')
		elif a == 2:
			if k >= 1:
				print(k - 1, 1, 0)
			else:
				print(-1)
		else:
			print(k, 0, 0)
sync_with_stdio(False)
main()


t = int(input())
for i in range(t):
	n = int(input())
	c = n // 3
	if n in [1, 2, 4]:
		print(-1)
		continue
	a = n % 3
	d = 0
	e = 0
	if a == 1:
		c -= 2
		e = 1
	elif a == 2:
		c -= 1
		d = 1
	print(c, d, e)


def comp_mat(a, b):
	if a[0] == b[0] and a[1] == b[1] and (a[2] == b[2]):
		return True
	return False
occ = [[0, 0, 0] for i in range(1001)]
occ[3][0] = 1
occ[5][1] = 1
occ[7][2] = 1
occ[6][0] = 2
for i in range(8, 1001):
	if not comp_mat(occ[i - 3], [0, 0, 0]):
		occ[i] = occ[i - 3][:]
		occ[i][0] += 1
	elif not comp_mat(occ[i - 5], [0, 0, 0]):
		occ[i] = occ[i - 5][:]
		occ[i][1] += 1
	elif not comp_mat(occ[i - 7], [0, 0, 0]):
		occ[i] = occ[i - 7][:]
		occ[i][2] += 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	if comp_mat(occ[n], [0, 0, 0]):
		print(-1)
	else:
		print(occ[n][0], occ[n][1], occ[n][2])


for i in range(int(input())):
	num = int(input())
	three = num // 3
	num = num - three * 3
	five = num // 5
	num = num - five * 5
	seven = num // 7
	num = num - seven * 7
	if num != 0:
		while three > 0 and num < 7 and (num != 3) and (num != 5) and (num != 7):
			num += 3
			three -= 1
		if num == 3:
			three += 1
		elif num == 5:
			five += 1
		elif num == 7:
			seven += 1
		else:
			print(-1)
			continue
	print(three, five, seven)


import heapq
import collections
from math import log2
import itertools
from functools import lru_cache
from sys import setrecursionlimit as srl
srl(2 * 10 ** 6)
N = 200001

def solve(n):
	if n < 3 or n == 4:
		return [-1]
	elif n % 3 == 0:
		return [n // 3, 0, 0]
	elif (n - 5) % 3 == 0:
		return [(n - 5) // 3, 1, 0]
	else:
		return [(n - 7) // 3, 0, 1]
t = int(input())
for _ in range(1, t + 1):
	n = int(input())
	print(*solve(n))


from copy import copy
from math import inf
from collections import defaultdict, deque
n = 1000 + 1
ans = [(0, 0, 0), (0, 0, 0), (0, 0, 0), (1, 0, 0), (0, 0, 0), (0, 1, 0), (2, 0, 0), (0, 0, 1)]
for i in range(8, n):
	(a, b, c) = ans[i - 3]
	if a or b or c:
		ans.append((a + 1, b, c))
		continue
	(a, b, c) = ans[i - 5]
	if a or b or c:
		ans.append((a, b + 1, c))
		continue
	(a, b, c) = ans[i - 7]
	if a or b or c:
		ans.append((a, b, c + 1))
		continue
	ans.append((0, 0, 0))

def main():
	for _ in range(int(input())):
		n = int(input())
		c = ans[n]
		if c == (0, 0, 0):
			print(-1)
		else:
			print(*c)
main()


t = int(input())
while t > 0:
	n = int(input())
	threes = 0
	fives = 0
	sevens = 0
	notPossible = False
	while n != 0:
		if n % 3 == 0:
			threes += n // 3
			n = 0
		elif (n - 7) % 3 == 0 and n - 7 >= 0:
			sevens += 1
			n -= 7
		elif (n - 5) % 3 == 0 and n - 5 >= 0:
			fives += 1
			n -= 5
		else:
			notPossible = True
			break
	if notPossible:
		print(-1)
	else:
		print(threes, fives, sevens)
	t -= 1


t = int(input())
s = {1, 2, 4}
for i in range(t):
	n = int(input())
	if n in s:
		print(-1)
	else:
		if n % 3 == 0:
			ans = [n // 3, 0, 0]
		elif n % 3 == 1:
			ans = [(n - 7) // 3, 0, 1]
		else:
			ans = [(n - 5) // 3, 1, 0]
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	res = [None] * (n + 1)
	res[0] = [0, 0, 0]
	for i in range(0, n + 1):
		if res[i] is not None:
			if i + 3 <= n:
				res[i + 3] = [res[i][0] + 1, res[i][1], res[i][2]]
			if i + 5 <= n:
				res[i + 5] = [res[i][0], res[i][1] + 1, res[i][2]]
			if i + 7 <= n:
				res[i + 7] = [res[i][0], res[i][1], res[i][2] + 1]
	if res[n] is None:
		print(-1)
	else:
		print(res[n][0], res[n][1], res[n][2])


t = int(input())
while t:
	n = int(input())
	x = n % 3
	y = n // 3
	if x == 0:
		print(n // 3, 0, 0)
	elif x == 1 and y > 1:
		print(y - 2, 0, 1)
	elif x == 2 and y > 0:
		print(y - 1, 1, 0)
	else:
		print(-1)
	t += -1


import math
tt = int(input())
while tt:
	tt -= 1
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print('-1')
	elif n % 3 == 0:
		print(int(n / 3), '0', '0')
	elif n % 3 == 1:
		print(int((n - 7) / 3), '0', '1')
	else:
		print(int((n - 5) / 3), '1', '0')


for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(-1)
	if n == 2:
		print(-1)
	if n == 4:
		print(-1)
	if n // 3 == (n - 2) / 3 and n > 4:
		print(int(n // 3 - 1), 1, 0)
	if n // 3 == n / 3:
		print(int(n / 3), 0, 0)
	elif n // 3 == (n - 1) / 3 and n > 4:
		print(int(n // 3 - 2), 0, 1)


for run in range(int(input())):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif (n - 5) % 3 == 0:
		print((n - 5) // 3, 1, 0)
	elif (n - 7) % 3 == 0:
		print((n - 7) // 3, 0, 1)


t = int(input())

def ans(a):
	if a == 1 or a == 2 or a == 4:
		print(-1)
		return
	if a % 3 == 0:
		print(a // 3, 0, 0)
		return
	if (a - 5) % 3 == 0:
		print((a - 5) // 3, 1, 0)
		return
	if (a - 7) % 3 == 0:
		print((a - 7) // 3, 0, 1)
		return
	print(-1)
while t:
	t -= 1
	n = int(input())
	ans(n)


from __future__ import division
from sys import stdin, stdout
from collections import deque, defaultdict, Counter
rstr = lambda : stdin.readline().strip()
rstrs = lambda : [str(x) for x in stdin.readline().split()]
rint = lambda : int(stdin.readline())
rints = lambda : [int(x) for x in stdin.readline().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
pr = lambda args, sep: stdout.write(sep.join(map(str, args)) + '\n')
out = []
for _ in range(int(input())):
	n = rint()
	(div, mod) = divmod(n, 3)
	while div and mod not in [0, 3, 5, 7]:
		div -= 1
		mod += 3
	if mod and mod not in [3, 5, 7]:
		out.append('-1')
	elif mod == 7:
		out.append(' '.join(map(str, [div, 0, 1])))
	elif mod == 5:
		out.append(' '.join(map(str, [div, 1, 0])))
	else:
		out.append(' '.join(map(str, [div, 0, 0])))
print('\n'.join(out))


from sys import stdin, stdout
terms = int(stdin.readline())
w = []
for window in range(terms):
	w.append(int(stdin.readline()))
r = []
for n in w:
	a = b = c = 0
	if n == 1 or n == 2 or n == 4:
		stdout.write('-1\n')
	elif n % 3 == 0:
		stdout.write(str(n // 3) + ' 0 0\n')
	elif n % 3 == 1:
		stdout.write(str((n - 7) // 3) + ' 0 1\n')
	else:
		stdout.write(str((n - 5) // 3) + ' 1 0\n')


t = int(input())
for x in range(t):
	n = int(input())
	y = int(n / 3)
	z = n % 3
	if z == 1 and n > 4:
		y = y - 2
		c = 1
		print(str(y) + ' 0 ' + str(c))
	elif z == 2 and n > 4:
		y = y - 1
		b = 1
		print(str(y) + ' ' + str(b) + ' 0')
	elif z == 0:
		print(str(y) + ' 0 0')
	else:
		print('-1')


t = int(input())
for q in range(t):
	n = int(input())
	if n < 6:
		if n == 3:
			print(1, 0, 0)
		elif n == 5:
			print(0, 1, 0)
		else:
			print(-1)
	else:
		a = n // 3
		n = n % 3
		if n == 2:
			print(a - 1, 1, 0)
		elif n == 1:
			print(a - 2, 0, 1)
		else:
			print(a, 0, 0)


def ans_if_list(ans):
	if isinstance(ans, str):
		return ans
	elif isinstance(ans, int):
		return ans
	else:
		return ' '.join((str(ans[i]) for i in range(len(ans))))
t = int(input())
for q in range(t):
	window = int(input())
	t_r = window // 3
	if window in [1, 2, 3, 4, 5, 6, 7]:
		if window == 1:
			ans_ls = -1
		if window == 2:
			ans_ls = -1
		if window == 3:
			ans_ls = [1, 0, 0]
		if window == 4:
			ans_ls = -1
		if window == 5:
			ans_ls = [0, 1, 0]
		if window == 6:
			ans_ls = [2, 0, 0]
		if window == 7:
			ans_ls = [0, 0, 1]
	elif window - t_r * 3 == 0:
		ans_ls = [t_r, 0, 0]
	elif window - t_r * 3 == 1:
		ans_ls = [t_r - 2, 0, 1]
	elif window - t_r * 3 == 2:
		ans_ls = [t_r - 1, 1, 0]
	print(ans_if_list(ans_ls))


try:
	test = int(input())
	for _ in range(test):
		n = int(input())
		ans = n // 3
		if n == 1 or n == 2 or n == 4:
			print('-1')
		elif n == 5:
			print('0 1 0')
		elif n == 7:
			print('0 0 1')
		elif n % 3 == 2:
			print(str(ans - 1) + ' 1 0')
		elif n % 3 == 1:
			print(str(ans - 2) + ' 0 1')
		else:
			print(str(ans) + ' 0 0')
except:
	pass


import sys, os
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
from time import time
MOD = 998244353

def main():
	for _ in range(int(input())):
		n = int(input())
		p = n // 3
		r = n % 3
		if r == 1 and p > 1:
			print(p - 2, 0, 1)
		elif r == 2 and p > 0:
			print(p - 1, 1, 0)
		elif r == 0:
			print(p, 0, 0)
		else:
			print(-1)
main()


for _ in range(int(input())):
	n = int(input())
	if n <= 4:
		if n == 3:
			print('1 0 0')
		else:
			print(-1)
		continue
	ans = [0, 0, 0]
	q = n // 3
	m = n % 3
	if m == 0:
		ans[0] = q
	elif m == 1:
		q -= 2
		sv = 1
		ans[0] = q
		ans[2] = sv
	else:
		q -= 1
		fv = 1
		ans[0] = q
		ans[1] = fv
	print(*ans)


t = int(input())
possible = [False for i in range(1010)]
possible[0] = True
for i in range(1000):
	if possible[i] is False:
		continue
	else:
		possible[i + 3] = possible[i + 5] = possible[i + 7] = True
for _ in range(t):
	n = int(input())
	if possible[n]:
		counts = [0, 0, 0]
		while n != 0:
			if possible[n - 3]:
				counts[0] += 1
				n -= 3
			elif possible[n - 5]:
				counts[1] += 1
				n -= 5
			else:
				counts[2] += 1
				n -= 7
		print(' '.join(map(str, counts)))
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3 or (n > 3 and n < 5):
		print(-1)
	else:
		f = n // 3
		r = n % 3
		if r == 0:
			print(f, 0, 0)
		elif r == 1:
			f = f - 2
			print(f, 0, 1)
		elif r == 2:
			f = f - 1
			print(f, 1, 0)


for _ in range(int(input())):
	w = int(input())
	l = [0, 0, 0]
	l[0] = w // 3
	if w % 3 == 2 and w >= 5:
		l[0] -= 1
		l[1] = 1
	elif w % 3 == 1 and w >= 7:
		l[0] -= 2
		l[2] = 1
	elif w % 3 != 0:
		print(-1)
		continue
	print(*l)


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)
	else:
		print(n // 3 - 2, 0, 1)


T = int(input())
for t in range(T):
	n = int(input())
	r = n % 3
	if r == 0:
		print(n // 3, 0, 0)
	if r == 2:
		if n >= 5:
			print((n - 5) // 3, 1, 0)
		else:
			print(-1)
	if r == 1:
		if n >= 7:
			print((n - 7) // 3, 0, 1)
		else:
			print(-1)


for _ in range(int(input())):
	n = int(input())
	(xi, yi, zi) = (0, 0, 0)
	for x in range(n // 3 + 1):
		for y in range(n // 3 + 1):
			z = (3 * x + 5 * y - n) / 7
			if z < 0:
				z = z * -1
			if 3 * x + 5 * y + 7 * z == n and z.is_integer():
				(xi, yi, zi) = (x, y, int(z))
				break
	if xi == yi == zi == 0:
		print(-1)
	else:
		print(xi, yi, zi)


for _ in range(int(input())):
	n = int(input())
	x = n // 3
	y = n % 3
	if y == 0:
		print(x, 0, 0)
	elif y == 1:
		o = x - 2
		if o >= 0:
			print(o, 0, 1)
		else:
			print(-1)
	else:
		o = x - 1
		if o >= 0:
			print(o, 1, 0)
		else:
			print(-1)


import math
for _ in range(int(input())):
	n = int(input())
	x = n // 3
	if x >= 2:
		if n % 3 == 0:
			print('{0} {1} {2}'.format(x, 0, 0))
		elif n % 3 == 1:
			print('{0} {1} {2}'.format(x - 2, 0, 1))
		else:
			print('{0} {1} {2}'.format(x - 1, 1, 0))
	elif n == 1 or n == 2 or n == 4:
		print(-1)
	elif n == 3:
		print('1 0 0')
	elif n == 5:
		print('0 1 0')


import math

def solve():
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		if n - 7 < 0:
			print(-1)
			return
		print((n - 7) // 3, 0, 1)
	else:
		if n - 5 < 0:
			print(-1)
			return
		print((n - 5) // 3, 1, 0)
for i in range(int(input())):
	solve()


def deptos(n: int) -> []:
	if n % 3 == 0:
		return [n // 3, 0, 0]
	elif n % 3 == 1:
		return [(n - 7) // 3, 0, 1]
	else:
		return [(n - 5) // 3, 1, 0]
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		sol = deptos(n)
		print(f'{sol[0]} {sol[1]} {sol[2]}')


for _ in [0] * int(input()):
	n = int(input())
	print([f'{n // 3} 0 0', f'{(n - 7) // 3} 0 1' * (n > 4) + '-1' * (n < 5), f'{(n - 5) // 3} 1 0' * (n > 4) + '-1' * (n < 5)][n % 3])


import io
import os
from collections import Counter, defaultdict, deque

def f(n):
	if n % 3 == 0:
		return '{} 0 0'.format(n // 3)
	elif n % 3 == 1:
		n -= 7
		if n < 0:
			return '-1'
		else:
			return '{} 0 {}'.format(n // 3, 1)
	elif n % 3 == 2:
		n -= 5
		if n < 0:
			return '-1'
		else:
			return '{} {} 0'.format(n // 3, 1)
t = int(input())
result = []
for i in range(t):
	n = int(input())
	result.append(f(n))
for i in range(t):
	print(result[i])


def arrIn():
	return list(map(int, input().split()))

def mapIn():
	return map(int, input().split())
a = []
for i in range(1001):
	a.append([0, 0, 0])
a[3] = [1, 0, 0]
a[5] = [0, 1, 0]
a[7] = [0, 0, 1]
for i in range(1001):
	if sum(a[i]) != 0:
		if i + 3 < 1001:
			a[i + 3] = a[i][:]
			a[i + 3][0] += 1
		if i + 5 < 1001:
			a[i + 5] = a[i][:]
			a[i + 5][1] += 1
		if i + 7 < 1001:
			a[i + 7] = a[i][:]
			a[i + 7][2] += 1
for ii in range(int(input())):
	n = int(input())
	if sum(a[n]) == 0:
		print(-1)
	else:
		x = a[n]
		print(x[0], x[1], x[2])


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=300006, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
for ik in range(int(input())):
	n = int(input())
	t = n % 3
	ans = [0, 0, 0]
	ans[0] = n // 3 - 1
	if t == 0:
		ans[0] += 1
	if t == 2:
		ans[1] += 1
	if t == 1:
		ans[0] -= 1
		ans[2] += 1
	if min(ans) >= 0:
		print(*ans)
	else:
		print(-1)


def solve():
	n = int(input())
	(b, c) = (0, 0)
	if n % 3 == 1:
		n -= 7
		c += 1
	if n % 3 == 2:
		n -= 5
		b += 1
	if n < 0:
		print(-1)
	else:
		print(n // 3, b, c)
t = int(input())
for i in range(t):
	solve()


from math import *
t = int(input())
while t:
	t = t - 1
	n = int(input())
	x = n // 3
	n = n % 3
	if n == 0:
		print(x, 0, 0)
		continue
	if n == 1:
		if x >= 2:
			print(x - 2, 0, 1)
		else:
			print(-1)
		continue
	if n == 2:
		if x >= 1:
			print(x - 1, 1, 0)
		else:
			print(-1)
		continue
	print(-1)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
dp = [-1] * 1001
dp[0] = [0, 0, 0]
z = [3, 5, 7]
for i in range(0, 1001):
	if type(dp[i]) == list:
		t = dp[i]
		for j in range(3):
			if z[j] + i <= 1000:
				tmp = list(dp[i])
				tmp[j] += 1
				dp[z[j] + i] = tmp

def solve():
	n = mint()
	if type(dp[n]) == int:
		print(dp[n])
	else:
		print(*dp[n])
for i in range(mint()):
	solve()


x = int(input())
for i in range(0, x):
	n = int(input())
	if n <= 4 and n != 3:
		print('-1')
	elif n % 3 == 2:
		g = n // 3 - 1
		print(g, 1, 0)
	elif n % 3 == 1:
		g = n // 3 - 2
		print(g, 0, 1)
	else:
		print(n // 3, 0, 0)


from collections import *
from itertools import *
from bisect import *

def inp():
	return int(input())

def arrinp():
	return [int(x) for x in input().split()]

def main():
	t = inp()
	for _ in range(t):
		n = inp()
		three = n // 3
		rem = n % 3
		if rem == 0:
			if three >= 0:
				print(three, 0, 0)
			else:
				print(-1)
			continue
		if rem == 1:
			three -= 2
			if three >= 0:
				print(three, 0, 1)
			else:
				print(-1)
			continue
		if rem == 2:
			three -= 1
			if three >= 0:
				print(three, 1, 0)
			else:
				print(-1)
			continue
main()


from sys import stdin, stdout
from math import gcd
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 3 == 1:
		print((n - 7) // 3, 0, 1)
	else:
		print((n - 5) // 3, 1, 0)


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	if n % 3 == 2:
		t = n // 3 - 1
		f = 1
		s = 0
	elif n % 3 == 1:
		t = n // 3 - 2
		f = 0
		s = 1
	elif n % 3 == 0:
		t = n // 3
		f = 0
		s = 0
	if 3 * t + 5 * f + 7 * s == n and t >= 0:
		print(t, f, s)
	else:
		print(-1)


def np(A):
	if A[0] == -1 and A[1] == -1 and (A[2] == -1):
		return True
	else:
		return False
t = int(input())
lookup = [[-1] * 3 for _ in range(1001)]
lookup[3] = [1, 0, 0]
lookup[5] = [0, 1, 0]
lookup[7] = [0, 0, 1]
lookup[6] = [2, 0, 0]
for i in range(8, len(lookup)):
	A = lookup[i - 3]
	B = lookup[i - 5]
	C = lookup[i - 7]
	if not np(A):
		ans = [A[0] + 1, A[1], A[2]]
		lookup[i] = ans
	elif not np(B):
		ans = [B[0], 1 + B[1], B[2]]
		lookup[i] = ans
	elif not np(C):
		ans = [C[0], C[1], C[2] + 1]
		lookup[i] = ans
for _ in range(t):
	n = int(input())
	if np(lookup[n]):
		print(-1)
	else:
		print(lookup[n][0], lookup[n][1], lookup[n][2])


t = int(input())

def res(n):
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 3 == 0:
		c = int(n / 3)
		print(c, 0, 0)
	elif n % 3 == 1:
		c = int((n - 7) / 3)
		print(c, 0, 1)
	else:
		c = int((n - 5) / 3)
		print(c, 1, 0)
for i in range(t):
	n = int(input())
	res(n)