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

Source: codeforces | Difficulty: EASY
Tags: Complete search

Mathematics

Constructive algorithms


Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
	elif n == 3:
		print('1 0 0')
	else:
		k = n // 5 - 1
		n = n - 5 * k
		if n == 5:
			print(0, k + 1, 0)
		if n == 6:
			print(2, k, 0)
		if n == 7:
			print(0, k, 1)
		if n == 8:
			print(1, k + 1, 0)
		if n == 9:
			print(3, k, 0)


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


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])


for i in range(int(input())):
	a = int(input())
	if a in [1, 2, 4]:
		print(-1)
	elif str(a)[-1] == '1':
		print(a // 10 + 1, 1, a // 10 - 1)
	elif str(a)[-1] == '2':
		print(a // 10 - 1, 1, a // 10)
	elif str(a)[-1] == '3':
		print(a // 10 + 1, 0, a // 10)
	elif str(a)[-1] == '4':
		print(a // 10 - 1, 0, a // 10 + 1)
	elif str(a)[-1] == '5':
		print(a // 10, 1, a // 10)
	elif str(a)[-1] == '6':
		print(a // 10 + 2, 0, a // 10)
	elif str(a)[-1] == '7':
		print(a // 10, 0, a // 10 + 1)
	elif str(a)[-1] == '8':
		print(a // 10 + 1, 1, a // 10)
	elif str(a)[-1] == '9':
		print(a // 10 + 3, 0, a // 10)
	else:
		print(a // 10, 0, a // 10)


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])


import math

def mi():
	return map(int, input().strip().split(' '))
for _ in range(int(input())):
	n = int(input())
	(f, f1) = (0, 0)
	for i in range(n):
		for j in range(n):
			for k in range(n):
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					f = 1
					break
			if f:
				f1 = 1
				break
		if f1:
			break
	else:
		print(-1)


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)


def kek():
	n = int(input())
	sem_cel = n // 7
	pyat_cel = n // 5
	tri_cel = n // 3
	flag = False
	for x in range(tri_cel + 1):
		for y in range(pyat_cel + 1):
			for z in range(sem_cel + 1):
				if x * 3 + y * 5 + z * 7 == n:
					flag = True
					print(x, y, z)
					break
			if flag:
				break
		if flag:
			break
	if not flag:
		print(-1)
t = int(input())
for i in range(t):
	kek()


from sys import *
from math import *
from bisect import *
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = [0] * 3
	if n % 3 == 0:
		a[0] += n // 3
		print(*a)
	else:
		f = 0
		i = 0
		f1 = f2 = 0
		while 1:
			if n < 0:
				f = 1
				break
			if n % 5 == 0:
				f1 = 1
				break
			if n % 7 == 0:
				f2 = 1
				break
			n -= 3
			i += 1
		if f == 1:
			print(-1)
		else:
			a[0] += i
			if f1 == 1:
				a[1] += n // 5
			elif f2 == 1:
				a[2] += n // 7
			print(*a)


def main():
	for _ in range(int(input())):
		n = int(input()) + 1
		l = [0] * n
		l[::3] = range(1, n + 1, 3)
		for i in range(5, n):
			if not l[i] and l[i - 5]:
				l[i] += l[i - 5] + 1024
		for i in range(7, n):
			if not l[i] and l[i - 7]:
				l[i] = l[i - 7] + 1048576
		t = l[-1]
		if t:
			(s, t) = divmod(t, 1048576)
			(f, t) = divmod(t, 1024)
			print(t // 3, f, s)
		else:
			print(-1)
main()


for s in [*open(0)][1:]:
	n = int(s)
	print(*next((((n - j) // 3, (j - i) // 5, i // 7) for i in range(0, n + 1, 7) for j in range(i, n + 1, 5) if (n - j) % 3 < 1), [-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)


def solve():
	n = int(input())
	for x in range(0, 334):
		if 3 * x > n:
			break
		for y in range(0, 201):
			if 3 * x + 5 * y > n:
				break
			for z in range(0, 143):
				if 3 * x + 5 * y + 7 * z > n:
					break
				if 3 * x + 5 * y + 7 * z == n:
					print(x, y, z)
					return
	print(-1)
	return

def main():
	t = int(input())
	for i in range(t):
		solve()
	return
main()


t = int(input())
for i in range(t):
	n = int(input())
	if n >= 3:
		(seven, five, three) = (0, 0, 0)
		if n % 7 == 0:
			print(0, 0, n // 7)
		elif n % 5 == 0:
			print(0, n // 5, 0)
		elif n % 3 == 0:
			print(n // 3, 0, 0)
		elif n % 8 == 0:
			print(n // 8, n // 8, 0)
		else:
			rem = n % 3
			three = n // 3
			if rem == 1 and n >= 10:
				three -= 2
				seven += 1
				print(three, five, 1)
			elif rem == 2 and n >= 11:
				three -= 1
				five += 1
				print(three, 1, seven)
			else:
				print(-1)
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 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:
		print(n // 3, '0 0')
	elif n >= 8:
		five = 0
		while n % 3 != 0 and n > 0:
			five += 1
			n = n - 5
		print(n // 3, five, '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)


import sys
for _ in range(int(input())):
	n = int(input())
	flag = 0
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if i * 3 + j * 5 + k * 7 == n:
					print(i, j, k)
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 0:
		print(-1)


t = int(input())
while t:
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		s = n // 7
		if n % 7 == 0:
			print(0, 0, s)
		if n % 7 == 1:
			print(1, 1, s - 1)
		if n % 7 == 2:
			print(3, 0, s - 1)
		if n % 7 == 3:
			print(1, 0, s)
		if n % 7 == 4:
			print(2, 1, s - 1)
		if n % 7 == 5:
			if n == 5:
				print(0, 1, 0)
			else:
				print(4, 0, s - 1)
		if n % 7 == 6:
			print(2, 0, s)
	t -= 1


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)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict, Counter
from os import path
import bisect as bi
import heapq
mod = 10 ** 9 + 7

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 inp():
		return int(input())

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

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

	def minp():
		return map(int, stdin.readline().split())
for _ in range(inp()):
	n = inp()
	flag = 0
	for i in range(201):
		for j in range(150):
			if (n - 5 * i - 7 * j) % 3 == 0 and n - 5 * i - 7 * j >= 0:
				flag = 1
				index = [(n - 5 * i - 7 * j) // 3, i, j]
				break
		if flag:
			break
	if flag:
		print(*index)
	else:
		print(-1)


t = int(input())
while t > 0:
	n = int(input())
	flag = 0
	y = 0
	z = 0
	while True:
		while True:
			if (n - 5 * y - 7 * z) % 3 == 0:
				flag = 1
				break
			z = z + 1
		if flag == 1:
			break
		y = y + 1
	x = (n - 5 * y - 7 * z) // 3
	if n == 5:
		print(0, 1, 0)
	elif n == 8:
		print(1, 1, 0)
	elif n == 11:
		print(2, 1, 0)
	elif x < 0 or y < 0 or z < 0:
		print(-1)
	else:
		print(x, y, z)
	t = t - 1


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
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 main():
	t = int(input())
	for i in range(t):
		n = int(input())
		(a, b, c) = (n // 3, n // 5, n // 7)
		ans = []
		f = False
		for x in range(a + 1):
			if f:
				break
			for y in range(b + 1):
				if f:
					break
				for z in range(c + 1):
					if 3 * x + y * 5 + z * 7 == n:
						f = True
						ans.append(x)
						ans.append(y)
						ans.append(z)
						break
		if f:
			print(' '.join([str(x) for x in ans]))
		else:
			print(-1)
main()


def helper(target, l, t, f, s):
	if l[target]:
		return
	if target < 3:
		return
	l[target] = True
	if target % 3 == 0:
		return [t + target // 3, f, s]
	elif target % 5 == 0:
		return [t, f + target // 5, s]
	elif target % 7 == 0:
		return [t, f, s + target // 7]
	else:
		t1 = helper(target - 3, l, t + 1, f, s)
		f1 = helper(target - 5, l, t, f + 1, s)
		s1 = helper(target - 7, l, t, f, s + 1)
		if t1 != [0, 0, 0]:
			return t1
		elif f1 != [0, 0, 0]:
			return f1
		elif s1 != [0, 0, 0]:
			return s1
		else:
			return [0, 0, 0]
for _ in range(int(input())):
	n = int(input())
	l = [False] * (n + 1)
	res = helper(n, l, 0, 0, 0)
	if not res:
		print('-1')
	else:
		(three, five, seven) = res
		print(three, five, seven)


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)


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

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

def si():
	return input().rstrip()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')

def solve():
	for _ in range(ii()):
		n = ii()
		x = n // 7
		n %= 7
		if n == 0:
			print(0, 0, x)
			continue
		if n == 5:
			print(0, 1, x)
			continue
		if n == 6 or n == 3:
			print(n // 3, 0, x)
			continue
		if x == 0:
			print('-1')
			continue
		if n == 1:
			print(1, 1, x - 1)
			continue
		if n == 2:
			print(3, 0, x - 1)
			continue
		if n == 4:
			print(2, 1, x - 1)
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
solve()


for t in range(int(input())):
	n = int(input())
	three_room = n // 3
	five_room = n // 5
	seven_room = n // 7
	result = 0
	for i in range(0, three_room + 1):
		for j in range(0, five_room + 1):
			if 3 * i + 5 * j > n:
				break
			for k in range(0, seven_room + 1):
				if 3 * i + 5 * j + 7 * k == n:
					result = 1
					break
			if result == 1:
				break
		if result == 1:
			break
	if result == 1:
		print(i, j, k)
	else:
		print(-1)


import os
import sys
from io import BytesIO, IOBase
import math

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')

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

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

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

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c
for xyz in range(0, int(input())):
	n = int(input())
	f = True
	for i in range(0, 1 + n // 3):
		if f:
			for j in range(0, 1 + n // 5):
				if f:
					for k in range(0, 1 + n // 7):
						if f:
							if 3 * i + 5 * j + 7 * k == n:
								print(i, j, k)
								f = False
								break
	if f:
		print(-1)


from math import floor

def total(s, f, t):
	return s * 7 + f * 5 + t * 3
repeat = int(input())
for r in range(repeat):
	doors = int(input())
	three_doors = -1
	five_doors = -1
	seven_doors = -1
	highest_with_three = floor(doors / 3)
	highest_with_five = floor(doors / 5)
	highest_with_seven = floor(doors / 7)
	for s in range(highest_with_seven + 1):
		if three_doors != -1:
			break
		else:
			for f in range(highest_with_five + 1):
				if three_doors != -1:
					break
				else:
					for t in range(highest_with_three + 1):
						if total(s, f, t) == doors:
							three_doors = t
							five_doors = f
							seven_doors = s
							break
	if three_doors == -1:
		print(-1)
	else:
		print(three_doors, five_doors, seven_doors)


arr = [[-1]] * 1001
arr[3] = [1, 0, 0]
for i in range(5, 1001):
	if i % 3 == 0:
		arr[i] = [i // 3, 0, 0]
	elif i % 5 == 0:
		arr[i] = [0, i // 5, 0]
	elif i % 7 == 0:
		arr[i] = [0, 0, i // 7]
	else:
		arr[i] = arr[i - 3].copy()
		arr[i][0] += 1
for _ in range(int(input())):
	n = int(input())
	print(*arr[n])


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 _ in range(T):
	N = int(input())
	found = False
	for a in range(0, 1001, 7):
		for b in range(0, 1001, 5):
			if a + b > N:
				break
			c = N - a - b
			if c % 3 == 0:
				print(c // 3, b // 5, a // 7)
				found = True
				break
		if found:
			break
	if not found:
		print(-1)


t = int(input())
while t > 0:
	n = int(input())
	f = 0
	for i in range(n // 3 + 1):
		if f == 1:
			break
		for j in range(n // 5 + 1):
			if f == 1:
				break
			for k in range(n // 7 + 1):
				if f == 1:
					break
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					f = 1
	if f == 0:
		print(-1)
	t = t - 1


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


for _ in range(int(input())):
	n = int(input())
	c = 0
	for i in range(n // 7 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 3 + 1):
				if 7 * i + 5 * j + 3 * k == n:
					print(k, j, i)
					c = 1
					break
			if c == 1:
				break
		if c == 1:
			break
	if c == 0:
		print(-1)


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))


for _ in range(int(input())):
	n = int(input())
	if n < 3:
		print(-1)
		continue
	x = n // (3 + 5 + 7)
	(x3, x5, x7) = (x, x, x)
	temp = n % 15
	x3 += temp // 3
	temp %= 3
	if temp == 2:
		x3 -= 1
		x5 += 1
	elif temp == 1:
		if x3 < 2:
			x5 -= 1
			x3 += 2
		else:
			x3 -= 2
			x7 += 1
	if min(x3, x5, x7) < 0:
		print(-1)
	else:
		print(x3, x5, x7)


import os
import sys
from io import BytesIO, IOBase
_str = str
str = lambda x=b'': x if type(x) is bytes else _str(x).encode()
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')

def input():
	return sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	ok = False
	for seven in range(0, n + 1, 7):
		nn = n - seven
		for five in range(0, nn + 1, 5):
			(d, m) = divmod(nn - five, 3)
			if m == 0:
				print(d, five // 5, seven // 7)
				break
		else:
			continue
		break
	else:
		print(-1)


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

def arp(arr):
	return ' '.join([str(i) for i in arr])
from collections import deque, Counter
from math import ceil, sqrt, log2, log, floor
for _ in range(int(input())):
	(n,) = rl()
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		sev = n % 7
		five = n % 5
		three = n % 3
		if sev % 3 == 0:
			print(sev // 3, 0, n // 7)
		elif sev % 5 == 0:
			print(0, sev // 5, n // 7)
		elif five % 7 == 0:
			print(0, n // 5, five // 7)
		elif five % 3 == 0:
			print(five // 3, n // 5, 0)
		else:
			minsev = n - 7
			minfive = n - 5
			minthree = n - 3
			if minsev % 3 == 0 and minsev // 3 >= 0:
				print(minsev // 3, 0, 1)
			elif minsev % 5 == 0 and minsev // 5 >= 0:
				print(0, minsev // 5, 1)
			elif minfive % 3 == 0 and minfive // 3 >= 0:
				print(minfive // 3, 1, 0)
			else:
				print(-1)


test = int(input())
for _ in range(test):
	n = int(input())
	n1 = 0
	n2 = 0
	n3 = 0
	if n == 1 or n == 2 or n == 4:
		print('-1')
	else:
		while n > 0:
			if n % 3 == 0:
				n1 = n1 + n // 3
				n = 0
			elif n % 5 == 0:
				n2 = n2 + n // 5
				n = 0
			elif n % 7 == 0:
				n3 = n3 + n // 7
				n = 0
			else:
				n1 += 1
				n = n - 3
		print(n1, n2, n3)


from sys import stdin

def check(n):
	if n == 0:
		return [0, 0, 0]
	if n < 3:
		return [-1]
	for (idx, val) in enumerate([7, 5, 3]):
		t = check(n - val)
		if t[0] != -1:
			t[idx] += 1
			return t
	return [-1]
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	print(*check(n)[::-1])


import sys

def In():
	return sys.stdin.readline()

def Out(x):
	return sys.stdout.write(str(x) + '\n')

def solve(x):
	for i in range(x):
		for j in range(x):
			for k in range(x):
				if i * 3 + j * 5 + k * 7 == x:
					return [str(i), str(j), str(k)]
	return ['-1']
t = int(In())
for i in range(t):
	n = int(In())
	ans = solve(n)
	Out(' '.join(ans))


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 sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
for _ in range(int(input())):
	n = int(input())
	p = n // 7
	(x, y, z) = (-1, -1, -1)
	f = 0
	for i in range(p + 1):
		x = i
		q = (n - 7 * i) // 5
		for j in range(q + 1):
			y = j
			r = (n - 7 * i - 5 * j) // 3
			for k in range(r + 1):
				z = k
				if 7 * x + y * 5 + z * 3 == n:
					f = 1
					break
			if f:
				break
		if f:
			break
	if f:
		print(z, y, x)
	else:
		print(-1)


def root(n):
	list2 = []
	flag = 0
	for x in range(0, int(n / 3) + 1):
		for y in range(0, int((n - 3 * x) / 5) + 1):
			for z in range(0, int((n - 3 * x - 5 * y) / 7) + 1):
				if 3 * x + 5 * y + 7 * z == n:
					print(x, y, z)
					list2.append(x + y + z)
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if list2 == []:
		print(-1)
	return
list = []
t = int(input())
for i in range(0, t):
	list.append(int(input()))
for i in range(0, t):
	n = list[i]
	root(n)


import sys
for i in range(0, int(sys.stdin.readline())):
	wincount = int(sys.stdin.readline())
	out = '-1'
	broken = False
	for sevens in range(0, int(wincount / 7) + 1):
		for fives in range(0, int((wincount - 7 * sevens) / 5) + 1):
			threes = int((wincount - 7 * sevens - 5 * fives) / 3)
			if wincount - 7 * sevens - 5 * fives - 3 * threes == 0:
				broken = True
				out = str(int(threes)) + ' ' + str(int(fives)) + ' ' + str(int(sevens))
				break
		if broken:
			break
	sys.stdout.write(out)
	sys.stdout.write('\n')


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()


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


t = int(input())
for _ in range(t):
	(r3, r5, r7) = (0, 0, 0)
	f = False
	n = int(input())
	while n % 5 != 0 and n % 7 != 0 and (n % 3 != 0) and (n > 0):
		n -= 3
		r3 += 1
	if n % 3 == 0:
		r3 += n // 3
	elif n % 5 == 0:
		r5 += n // 5
	elif n % 7 == 0:
		r7 += n // 7
	else:
		f = True
	if not f:
		print(r3, r5, r7)
	else:
		print(-1)


import math
t = int(input())
end = 1 << 20
while t:
	t -= 1
	y = [int(i) for i in input().split()]
	n = y[0]
	f = 0
	for i in range(end):
		if f or n == 4 or n == 2 or (n == 1):
			break
		for j in range(end):
			k = n - i * 3 - j * 5
			if k >= 0 and (not k % 7):
				print(i, j, k // 7)
				f = 1
				break
	if not f:
		print(-1)


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])


noOfTestCases = int(input())
for i in range(noOfTestCases):
	n = int(input())
	now = False
	if n % 3 == 0:
		print(n // 3, 0, 0)
		now = True
	elif n % 5 == 0:
		print(0, n // 5, 0)
		now = True
	elif n % 7 == 0:
		print(0, 0, n // 7)
		now = True
	if now == False:
		nowsec = False
		length = n // 3
		a = [i * 3 for i in range(1, length + 1)]
		b = [i * 5 for i in range(1, length + 1)]
		c = [i * 7 for i in range(1, length + 1)]
		a1 = dict()
		for i in range(len(a)):
			if n - a[i] not in a1.keys():
				a1[i] = n - a[i]
		b1 = dict()
		for i in range(len(b)):
			if n - b[i] not in a1.keys():
				b1[i] = n - b[i]
		c1 = dict()
		for i in range(len(c)):
			if n - c[i] not in c1.keys():
				c1[i] = n - c[i]
		for i in range(len(a)):
			if b[i] in a1.values():
				print((n - b[i]) // 3, b[i] // 5, 0)
				nowsec = True
				break
		if nowsec == False:
			for i in range(len(b)):
				if c[i] in b1.values():
					print(0, (n - c[i]) // 5, c[i] // 7)
					nowsec = True
					break
		if nowsec == False:
			for i in range(len(c)):
				if c[i] in a1.values():
					print((n - c[i]) // 3, 0, c[i] // 7)
					nowsec = True
					break
		if nowsec == False:
			s = set()
			f = False
			for i in range(len(a)):
				s.add(a[i])
			for i in range(len(b)):
				for j in range(len(c)):
					if n - b[i] - c[j] in s:
						print((n - b[i] - c[j]) // 3, b[i] // 5, c[j] // 7)
						f = True
						break
				if f:
					break
			if f == False:
				print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	three = 0
	five = 0
	seven = 0
	ok = False
	while n > 0:
		if n % 7 == 0:
			ok = True
			seven = n // 7
			break
		if n % 5 == 0:
			ok = True
			five = n // 5
			break
		n -= 3
		three += 1
	if ok or n == 0:
		print(three, five, seven)
	else:
		print(-1)


def search(k):
	for z in range(k):
		for y in range(k):
			x = (k - 5 * y - 7 * z) / 3
			if x == int(x) and x >= 0:
				return (int(x), int(y), int(z))
	return [-1]
for _ in range(int(input())):
	n = int(input())
	print(*search(n))


def solve(n):
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if i * 3 + j * 5 + k * 7 == n:
					return [i, j, k]
t = int(input())
for i in range(t):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
		continue
	arr = solve(n)
	print(*arr)


def windowCount(n):
	if n in [1, 2, 4]:
		print(-1)
		return
	arr = [0, 0, 0]
	if n % 7 == 0:
		arr[2] = n // 7
	elif n % 7 in [1, 2, 4]:
		arr[2] = n // 7 - 1
		x = n % 7 + 7
		if x == 8:
			(arr[0], arr[1]) = (1, 1)
		elif x == 9:
			arr[0] = 3
		else:
			(arr[0], arr[1]) = (2, 1)
	else:
		arr[2] = n // 7
		x = n % 7
		if x == 3:
			arr[0] = 1
		elif x == 5:
			arr[1] = 1
		else:
			arr[0] = 2
	print(*arr)
	return
for t in range(int(input())):
	windowCount(int(input()))


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())
list1 = []
for i in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		list1.append([-1])
	elif n % 3 == 0:
		list1.append([n // 3, 0, 0])
	elif n % 3 == 2:
		list1.append([n // 3 - 1, 1, 0])
	else:
		list1.append([n // 3 - 2, 0, 1])
for i in list1:
	for j in i:
		print(j, end=' ')
	print()


t = int(input())
while t != 0:
	n = int(input())
	if n <= 2 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 -= 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)


t = int(input())

def check(n):
	(three, five, seven) = (n // 3, n // 5, n // 7)
	for i in range(three + 1):
		for j in range(five + 1):
			for k in range(seven + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return [i, j, k]
	return False
while t:
	t -= 1
	n = int(input())
	if check(n):
		(a, b, c) = check(n)
		print('%d %d %d' % (a, b, c))
	else:
		print('-1')


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	n = int(ii())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n < 15:
		if n == 3:
			print(1, 0, 0)
		elif n == 5:
			print(0, 1, 0)
		elif n == 6:
			print(2, 0, 0)
		elif n == 7:
			print(0, 0, 1)
		elif n == 8:
			print(1, 1, 0)
		elif n == 9:
			print(3, 0, 0)
		elif n == 10:
			print(1, 0, 1)
		elif n == 11:
			print(2, 1, 0)
		elif n == 12:
			print(4, 0, 0)
		elif n == 13:
			print(1, 2, 0)
		elif n == 14:
			print(0, 0, 2)
	else:
		d = n // 15 - 1
		(a, b, c) = (d, d, d)
		n %= 15
		n += 15
		if n == 15:
			b += 3
		elif n == 16:
			a += 2
			b += 2
		elif n == 17:
			b += 2
			c += 1
		elif n == 18:
			a += 6
		elif n == 19:
			a += 4
			c += 1
		elif n == 20:
			b += 4
		elif n == 21:
			c += 3
		elif n == 22:
			b += 3
			c += 1
		elif n == 23:
			a += 6
			b += 1
		elif n == 24:
			a += 8
		elif n == 25:
			b += 5
		elif n == 26:
			a += 7
			b += 1
		elif n == 27:
			a += 9
		elif n == 28:
			c += 4
		elif n == 29:
			a += 8
			b += 1
		print(a, b, c)
	return
for t in range(int(ii())):
	solve()


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	n = sInt()
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif n % 3 == 2 and n >= 5:
		print((n - 5) // 3, 1, 0)
	elif n % 3 == 1 and n >= 7:
		print((n - 7) // 3, 0, 1)
	elif n % 5 == 2 and n >= 7:
		print(0, (n - 7) // 5, 1)
	else:
		print(-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)


t = int(input())
while t:
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif (n - 3) % 5 == 0 and (n - 3) // 5 > 0:
		print(1, (n - 3) // 5, 0)
	elif (n - 3) % 7 == 0 and (n - 3) // 7 > 0:
		print(1, 0, (n - 3) // 7)
	elif (n - 5) % 3 == 0 and (n - 5) // 3 > 0:
		print((n - 5) // 3, 1, 0)
	elif (n - 5) % 7 == 0 and (n - 5) // 7 > 0:
		print(0, 1, (n - 5) // 7)
	elif (n - 7) % 3 == 0 and (n - 7) // 3 > 0:
		print((n - 7) // 3, 0, 1)
	elif (n - 7) % 5 == 0 and (n - 7) // 5 > 0:
		print(0, (n - 7) // 5, 1)
	else:
		print(-1)
	t = t - 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)


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')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def main():
	for _ in range(readint()):
		n = readint()
		ans = False
		for i in range(151):
			for j in range(202):
				if j * 5 + i * 7 <= n and (n - j * 5 - i * 7) % 3 == 0:
					print((n - j * 5 - i * 7) // 3, j, i)
					ans = True
					break
			if ans:
				break
		if not ans:
			print(-1)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a7 = n // 7
	N = n
	n = n % 7
	if n == 6 or n == 3:
		print(n // 3, 0, a7)
		continue
	if n == 5:
		print(0, 1, a7)
		continue
	if n == 4:
		if a7 > 0:
			print(2, 1, a7 - 1)
		else:
			print(-1)
		continue
	if n == 2:
		if a7 > 0:
			print(3, 0, a7 - 1)
		else:
			print(-1)
		continue
	if n == 1:
		if a7 > 0:
			print(1, 1, a7 - 1)
		else:
			print(-1)
		continue
	print(0, 0, a7)


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 t in range(int(input())):
	n = int(input())
	a = []
	if n % 3 == 0 or n % 5 == 0 or n % 7 == 0:
		if n % 3 == 0:
			a = [n // 3, 0, 0]
		elif n % 5 == 0:
			a = [0, n // 5, 0]
		else:
			a = [0, 0, n // 7]
	elif (n - 7) % 5 == 0:
		a = [0, (n - 7) // 5, 1]
	elif (n - 3) % 5 == 0:
		a = [1, (n - 3) // 5, 0]
	elif (n - 5) % 7 == 0:
		a = [0, 1, (n - 5) // 7]
	elif (n - 3) % 7 == 0:
		a = [1, 0, (n - 3) // 7]
	elif (n - 5) % 3 == 0:
		a = [(n - 5) // 3, 1, 0]
	elif (n - 7) % 3 == 0:
		a = [(n - 7) // 3, 0, 1]
	if sum(a) < 1:
		print('-1')
	else:
		for i in a:
			print(i, end=' ')


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


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')


for _ in range(0, int(input())):
	n = int(input())
	three = 0
	five = 0
	seven = 0
	while n != 0:
		if n - 7 == 0 or n - 7 >= 7:
			seven += 1
			n = n - 7
			continue
		if n - 5 == 0 or n - 5 >= 5:
			five += 1
			n = n - 5
			continue
		if n - 3 >= 0:
			three += 1
			n = n - 3
			continue
		if n < 3:
			break
	if n != 0:
		print(-1)
	else:
		print(three, five, seven)


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)


for _ in range(int(input())):
	n = int(input())
	flag = 0
	flag1 = 0
	flag2 = 0
	ans = []
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if i * 3 + j * 5 + k * 7 == n:
					ans.append([i, j, k])
					flag = 1
					break
			if flag == 1:
				flag2 = 1
				break
		if flag2 == 1:
			break
	if len(ans) == 0:
		print(-1)
	else:
		print(ans[0][0], ans[0][1], ans[0][2])


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]))


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
for _ in range(vary(1)):
	n = vary(1)
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		flag = 0
		for i in range(333):
			if flag == 2:
				break
			for j in range(333):
				if flag == 2:
					break
				if 3 * i + 5 * j > n:
					flag = 1
					break
				if (n - (3 * i + 5 * j)) % 7 == 0:
					print(i, j, (n - (3 * i + 5 * j)) // 7)
					flag = 2
					break
		if flag == 1:
			print(-1)


def solution():
	n = int(input())
	for i in range(201):
		for j in range(201):
			x = n - j * 7 - i * 5
			if x >= 0 and x % 3 == 0:
				print(x // 3, i, j)
				return
	print(-1)
t = int(input())
for _ in range(t):
	solution()


ts = int(input())
for t in range(ts):
	n3 = 0
	n5 = 0
	n7 = 0
	n = int(input())
	ls = [1, 2, 4]
	if n in ls:
		print(-1)
	elif n == 3:
		n3 = 1
		print(str(n3) + ' ' + str(n5) + ' ' + str(n7))
	else:
		n5 += n // 5 - 1
		n = n - 5 * n5
		if n == 5:
			n5 += 1
		if n == 6:
			n3 = 2
		if n == 7:
			n7 = 1
		if n == 8:
			n3 = 1
			n5 += 1
		if n == 9:
			n3 = 3
		print(str(n3) + ' ' + str(n5) + ' ' + str(n7))


t = int(input())
windows = [int(input()) for i in range(t)]
ans = [[] for i in range(t)]
for i in range(t):
	n = windows[i]
	if n < 3 or n == 4:
		ans[i].append(-1)
	else:
		ost7 = n % 7
		if ost7 == 0:
			ans[i].append(0)
			ans[i].append(0)
			ans[i].append(n // 7)
		elif ost7 % 3 == 0:
			ans[i].append(ost7 // 3)
			ans[i].append(0)
			ans[i].append(n // 7)
		elif ost7 == 1:
			ans[i].append(1)
			ans[i].append(1)
			ans[i].append(n // 7 - 1)
		elif ost7 == 2:
			ans[i].append(3)
			ans[i].append(0)
			ans[i].append(n // 7 - 1)
		elif ost7 == 4:
			ans[i].append(2)
			ans[i].append(1)
			ans[i].append(n // 7 - 1)
		elif ost7 == 5:
			ans[i].append(0)
			ans[i].append(1)
			ans[i].append(n // 7)
for i in ans:
	print(*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)


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


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline

def solve():
	n = int(input())
	for i in range(0, 334):
		if i * 3 > n:
			break
		for j in range(0, 334):
			if i * 3 + j * 5 > n:
				break
			for k in range(0, 334):
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					return
				if i * 3 + j * 5 + k * 7 > n:
					break
	print(-1)
for ii in range(int(input())):
	solve()


for i in range(int(input())):
	n = int(input())
	lst = [0, 0, 0]
	while n >= 3 and n not in [5, 7, 8, 10, 12, 15]:
		lst[0] += 1
		n -= 3
	if n != 0 and n in [5, 7, 8, 10, 12, 15]:
		if n == 5:
			lst[1] += 1
		elif n == 7:
			lst[2] += 1
		elif n == 8:
			lst[0] += 1
			lst[1] += 1
		elif n == 10:
			lst[0] += 1
			lst[2] += 1
		elif n == 12:
			lst[1] += 1
			lst[2] += 1
		else:
			lst[1] += 1
			lst[0] += 1
			lst[2] += 1
		lst[0] = str(lst[0])
		lst[1] = str(lst[1])
		lst[2] = str(lst[2])
		print(' '.join(lst))
	elif n != 0 and n not in [5, 7, 8, 10, 12, 15]:
		print('-1')
	else:
		lst[0] = str(lst[0])
		lst[1] = str(lst[1])
		lst[2] = str(lst[2])
		print(' '.join(lst))


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')
import math
import bisect
from collections import Counter
import bisect
for _ in range(int(input())):
	n = int(input())
	if n % 5 == 0:
		print(*[0, n // 5, 0])
	elif n % 3 == 0:
		print(*[n // 3, 0, 0])
	elif n % 7 == 0:
		print(*[0, 0, n // 7])
	else:
		ans = []
		for i in range(1000 // 3 + 2):
			for j in range(1000 // 5 + 1):
				if 3 * i + 5 * j == n:
					ans = [i, j, n - 3 * i - 5 * j]
					break
		if ans != []:
			print(*ans)
		else:
			print(-1)


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


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 i in range(t):
	n = int(input())
	a = int(n / 3)
	b = int(n / 5)
	c = int(n / 7)
	k = -1
	for io in range(a + 1):
		for it in range(b + 1):
			for ith in range(c + 1):
				if 3 * io + 5 * it + 7 * ith == n:
					k = 0
					print('{} {} {}'.format(io, it, ith))
					break
			if k != -1:
				break
		if k != -1:
			break
	if k == -1:
		print(k)


import sys
import math

def scan(input_type='int'):
	if input_type == 'int':
		return list(map(int, sys.stdin.readline().strip().split()))
	else:
		return list(map(str, sys.stdin.readline().strip()))

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


t = int(input())
for _ in range(t):
	n = int(input())
	threes = 0
	fives = n // 10 * 2
	sevens = 0
	ans = 0
	n %= 10
	if n == 9:
		threes = 3
	elif n == 8:
		fives += 1
		threes = 1
	elif n == 7:
		sevens = 1
	elif n == 6:
		threes = 2
	elif n == 5:
		fives += 1
	elif n == 4:
		if fives > 0:
			fives -= 2
			sevens = 2
		else:
			ans = -1
	elif n == 3:
		threes = 1
	elif n == 2:
		if fives > 0:
			fives -= 2
			threes = 4
		else:
			ans = -1
	elif n == 1:
		if fives > 0:
			fives -= 1
			threes = 2
		else:
			ans = -1
	if ans == -1:
		print(ans)
	else:
		print(str(threes) + ' ' + str(fives) + ' ' + str(sevens))


count = int(input())
for i in range(count):
	N = int(input())
	b = 0
	c = 0
	a = N // 7
	rest = N - a * 7
	if rest == 1:
		a = a - 1
		b = 1
		c = 1
	elif rest == 2:
		a = a - 1
		b = 0
		c = 3
	elif rest == 3:
		c = 1
	elif rest == 4:
		a = a - 1
		b = 1
		c = 2
	elif rest == 5:
		b = 1
	elif rest == 6:
		c = 2
	if N == 4 or N < 3:
		print(-1)
	else:
		print(c, b, a)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		t = 0
		for x in range(1000 // 7 + 1):
			for y in range(1000 // 5 + 1):
				tw = 7 * x + 5 * y
				lw = n - tw
				if lw >= 0 and lw % 3 == 0:
					z = lw // 3
					t = 1
					print(z, y, x)
					break
			if t == 1:
				break
		if t == 0:
			print(-1)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


t = int(input())
q = []
for i in range(t):
	n = int(input())
	count_3 = 0
	count_5 = 0
	count_7 = 0
	if n % 3 == 0:
		count_3 += n // 3
	elif (n - 5) % 3 == 0:
		count_5 += 1
		n = n - 5
		count_3 += n // 3
	else:
		count_7 += 1
		n = n - 7
		count_3 += n // 3
	if count_3 < 0 or count_5 < 0 or count_7 < 0:
		q.append([-1])
	else:
		q.append([count_3, count_5, count_7])
for i in q:
	for j in i:
		print(j, end=' ')
	print()


def main():
	N = int(input())
	for i in range(0, N // 3 + 1):
		for j in range(0, N // 5 + 1):
			if (N - (3 * i + 5 * j)) % 7 == 0:
				print(i, j, (N - (3 * i + 5 * j)) // 7)
				return
	print(-1)
for __ in [0] * int(input()):
	main()


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
for _ in range(int(input())):
	n = int(input())
	if n in (1, 2, 4):
		print(-1)
		continue
	elif n % 3 == 0:
		(t3, t5, t7) = (n // 3, 0, 0)
	elif n % 5 == 0:
		(t3, t5, t7) = (0, n // 5, 0)
	elif n % 7 == 0:
		(t3, t5, t7) = (0, 0, n // 7)
	elif n % 3 == 2:
		(t3, t5, t7) = (n // 3 - 1, 1, 0)
	elif n % 5 == 1:
		(t3, t5, t7) = (2, n // 5 - 1, 0)
	elif n % 5 == 2:
		(t3, t5, t7) = (0, n // 5 - 1, 1)
	elif n % 5 == 3:
		(t3, t5, t7) = (1, n // 5, 0)
	elif n % 5 == 4:
		(t3, t5, t7) = (3, n // 5 - 1, 0)
	elif n % 7 == 1:
		(t3, t5, t7) = (1, 1, n // 7 - 1)
	elif n % 7 == 2:
		(t3, t5, t7) = (3, 0, n // 7 - 1)
	elif n % 7 == 3:
		(t3, t5, t7) = (1, 0, n // 7)
	elif n % 7 == 4:
		(t3, t5, t7) = (2, 1, n // 7 - 1)
	elif n % 7 == 5:
		(t3, t5, t7) = (0, 1, n // 7)
	elif n % 7 == 6:
		(t3, t5, t7) = (2, 0, n // 7)
	else:
		print(-1)
		continue
	print('{0} {1} {2}'.format(t3, t5, t7))


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()


t = int(input())
for i in range(t):
	n = int(input())
	x = y = z = 0
	if n % 5 == 0:
		print('0 {} 0'.format(n // 5))
	else:
		f = n % 5
		c = n // 5
		if f % 3 == 0:
			x = f // 3
		elif f % 7 == 0:
			z = f // 7
		elif f % 3 != 0 or f % 7 != 0:
			c = c - 1
			f = f + 5
			if f % 3 == 0:
				x = f // 3
			elif f % 7 == 0:
				z = f // 7
		if x < 0 or y < 0 or z < 0 or (c < 0):
			print(-1)
		else:
			print(x, c, z)


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])


t = int(input())
for tt in range(0, t):
	n = int(input())
	ans = -1
	fi = -1
	se = -1
	th = -1
	for i in range(0, n // 7 + 1):
		left_sum = n - i * 7
		if left_sum % 5 == 0:
			fi = 0
			se = left_sum // 5
			th = i
	for i in range(0, n // 3 + 1):
		left_sum = n - i * 3
		if left_sum % 5 == 0:
			fi = i
			se = left_sum // 5
			th = 0
	if max(fi, se, th) > -1:
		print(fi, se, th, sep=' ')
	else:
		print(-1)


from sys import stdin, stdout
from collections import defaultdict
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	if n % 3 == 0:
		print(n // 3, 0, 0)
		return
	if n % 5 == 0:
		print(0, n // 5, 0)
		return
	if n % 7 == 0:
		print(0, 0, n // 7)
		return
	for i in range(70):
		for j in range(70):
			for k in range(70):
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					return
	print(-1)
for _ in range(inp()):
	solve()


import sys
import os
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')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n):
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if j == 5 and i == 3:
					print(i, j, k)
				if 3 * i + 5 * j + 7 * k == n:
					return str(i) + ' ' + str(j) + ' ' + str(k)
	return -1
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


t = int(input())
for _ in range(t):
	n = int(input())
	flag = False
	for r3 in range(0, 30):
		if flag:
			break
		for r5 in range(0, 30):
			k = n - r3 * 3 - r5 * 5
			if k >= 0 and k % 7 == 0:
				print(r3, r5, k // 7)
				flag = True
				break
	else:
		print(-1)


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def find(nok, d, step, n1):
	global b
	while n1 - nok > 0:
		if (n1 - nok) % d == 0:
			answer[step % 3] = int((n1 - nok) / d)
			answer[(step + 1) % 3] = int(nok / delitel[(step + 1) % 3])
			b = True
			break
		nok += nok

def find2(nok, d, step, n1):
	global b
	while n1 - nok > 0:
		if (n1 - nok) % delitel[(step + 1) % 3] == 0:
			answer[(step + 1) % 3] = int((n1 - nok) / delitel[(step + 1) % 3])
			answer[step % 3] = int(nok / d)
			b = True
			break
		elif (n1 - nok) % delitel[(step + 2) % 3] == 0:
			answer[(step + 2) % 3] = int((n1 - nok) / delitel[(step + 2) % 3])
			answer[step % 3] = int(nok / d)
			b = True
			break
		nok += nok
for n1 in a:
	x = 0
	y = 0
	z = 0
	step = 0
	answer = [x, y, z]
	NOK = [3, 5, 7, 35, 21, 15]
	delitel = [3, 5, 7]
	k = 1
	b = False
	if n1 % 3 == 0:
		answer[0] = int(n1 / 3)
	elif n1 % 5 == 0:
		answer[1] = int(n1 / 5)
	elif n1 % 7 == 0:
		answer[2] = int(n1 / 7)
	else:
		while n1 - NOK[step % 6] >= 0 and (not b):
			if step > 2:
				find(NOK[step % 6], delitel[step % 3], step, n1)
			else:
				find2(NOK[step % 6], delitel[step % 3], step, n1)
			step = step + 1
			k = 1
	if answer[0] == 0 and answer[1] == 0 and (answer[2] == 0):
		print(-1)
	else:
		print(answer[0], answer[1], answer[2])


for _ in range(int(input())):
	n = int(input())
	ff = 0
	for i in range(n + 1):
		f = 0
		for j in range(n + 1):
			k = n - i * 3 - j * 5
			if k % 7 == 0 and i >= 0 and (j >= 0) and (k >= 0):
				print(i, j, k // 7)
				f = 1
				break
		if f:
			ff = 1
			break
	if not ff:
		print(-1)


import sys
input = sys.stdin.readline
T = int(input())

def solve(N):
	if N % 3 == 0:
		return (N // 3, 0, 0)
	if N % 5 == 0:
		return (0, N // 5, 0)
	if N % 7 == 0:
		return (0, 0, N // 7)
	if N % 3 == 1 and N - 7 >= 0:
		return ((N - 7) // 3, 0, 1)
	if N % 3 == 2 and N - 5 >= 0:
		return ((N - 5) // 3, 1, 0)
	return (-1,)
for t in range(T):
	N = int(input())
	ans = solve(N)
	print(' '.join(map(str, ans)))


TC = int(input())
for tc in range(TC):
	N = int(input())
	result = None
	found = False
	for a in range(N // 7 + 1):
		t = N - a * 7
		for b in range(t // 5 + 1):
			t2 = t - b * 5
			if t2 % 3 == 0:
				result = '{} {} {}'.format(t2 // 3, b, a)
				found = True
				break
		if found:
			break
	if found:
		print(result)
	else:
		print(-1)


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)


for _ in range(int(input())):
	n = int(input())
	if n < 7:
		if n == 5:
			print(f'{0} {1} {0}')
		elif n == 3:
			print(f'{1} {0} {0}')
		elif n == 6:
			print(f'{2} {0} {0}')
		else:
			print(-1)
	else:
		a = n % 7
		if a == 0:
			print(f'{0} {0} {n // 7}')
		elif a == 6:
			print(f'{1} {2} {n // 7 - 1}')
		elif a == 5:
			print(f'{0} {1} {n // 7}')
		elif a == 4:
			print(f'{2} {1} {n // 7 - 1}')
		elif a == 3:
			print(f'{1} {0} {n // 7}')
		elif a == 2:
			print(f'{3} {0} {n // 7 - 1}')
		elif a == 1:
			print(f'{1} {1} {n // 7 - 1}')


for _ in range(int(input())):
	n = int(input())
	k = True
	for x in range(n // 3 + 1):
		for y in range(n // 5 + 1):
			for z in range(n // 7 + 1):
				if 3 * x + 5 * y + 7 * z == n:
					print(x, y, z)
					k = False
					break
			if k == False:
				break
		if k == False:
			break
	else:
		print(-1)


def rooms(n):
	rooms = n // 7
	ans = [0, 0, 0]
	if (n - 7 * rooms) % 5 == 0 or (n - 7 * rooms) % 3 == 0 or (n - 7 * rooms) % 8 == 0:
		ans[2] = rooms
	else:
		ans[2] = rooms - 1
		if ans[2] == -1:
			return [-1]
	n = n - ans[2] * 7
	rooms = n // 5
	if (n - 5 * rooms) % 3 == 0:
		ans[1] = rooms
	else:
		ans[1] = rooms - 1
		if ans[1] == -1:
			return [-1]
	n = n - ans[1] * 5
	rooms = n // 3
	if (n - 3 * rooms) % 3 == 0:
		ans[0] = rooms
	else:
		return [-1]
	n = n - ans[0] * 3
	if n == 0:
		return ans
	else:
		return [-1]
num = int(input())
a = []
for i in range(0, num):
	a.append(int(input()))
i = 0
while i < len(a):
	print(*rooms(a[i]))
	i = i + 1


sevennum = [0, 0, 7, 0, 0, 0, 0, 7, 0, 0]
seven = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0]
threenum = [0, 6, 0, 3, 9, 0, 6, 0, 3, 9]
three = [0, 2, 0, 1, 3, 0, 2, 0, 1, 3]
for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		mo = n % 10
		if threenum[mo] != 0:
			temp = n - threenum[mo]
			if temp < 0:
				print('-1')
			else:
				print(three[mo], temp // 5, 0)
		elif sevennum[mo] != 0:
			temp = n - sevennum[mo]
			if temp < 0:
				print('-1')
			else:
				print(0, temp // 5, seven[mo])


from collections import deque, defaultdict
n = int(input())
for x in range(n):
	k = int(input())
	flag = False
	for i in range(335):
		if flag:
			break
		for j in range(1000):
			if flag:
				break
			f = i * 3 + j * 5
			if f > k:
				break
			if (k - f) % 7 == 0:
				print(i, j, (k - f) // 7)
				flag = True
				break
	if not flag:
		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)


d = {}
i = 0
while i < 101:
	j = 0
	while j < 101:
		k = 0
		while k < 101:
			s = 3 * i + 5 * j + 7 * k
			d[s] = (i, j, k)
			k = k + 1
		j = j + 1
	i = i + 1
for _ in range(int(input())):
	n = int(input())
	if n < 3 or n == 4:
		print(-1)
	else:
		print(*d[n])


import math
tc = int(input())
for i in range(tc):
	flag = False
	no_of_windows = int(input())
	for x in range(math.ceil(no_of_windows / 3) + 1):
		if flag is True:
			break
		for y in range(math.ceil(no_of_windows / 5) + 1):
			if flag is True:
				break
			for z in range(math.ceil(no_of_windows / 7) + 1):
				if flag is True:
					break
				if 3 * x + 5 * y + 7 * z == no_of_windows:
					print(f'{x} {y} {z}')
					flag = True
	if flag is False:
		print(-1)


def solve(n):
	max7 = n // 7
	max5 = n // 5
	for i in range(max7 + 1):
		for j in range(max5 + 1):
			x = i * 7 + j * 5
			if n - x < 0:
				break
			if (n - x) % 3 == 0:
				print((n - x) // 3, j, i)
				return
	print(-1)
t = int(input())
ns = []
for _ in range(t):
	n = int(input())
	ns.append(n)
for n in ns:
	solve(n)


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


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 program():
	s = int(input())
	for a in range(s + 1):
		for b in range(s + 1):
			c = s - (3 * a + 5 * b)
			if c >= 0:
				if c == int(c) and c % 7 == 0:
					print(a, b, c // 7)
					return
	print(-1)
for i in range(int(input())):
	program()


t = int(input())
for i in range(t):
	n = int(input())
	ans = [0, 0, 0]
	if n == 1 or n == 2 or n == 4:
		print(-1)
		continue
	if n > 20:
		ans[1] += (n - 20) // 5
		n -= ans[1] * 5
	flag = 0
	for i in range(5):
		for j in range(5):
			for k in range(5):
				if 3 * i + 5 * j + 7 * k == n:
					flag = 1
					ans[0] += i
					ans[1] += j
					ans[2] += k
					break
			if flag == 1:
				break
		if flag == 1:
			break
	print(*ans)


def f(n):
	if n <= 4 and n != 3:
		return -1
	else:
		for i in range(n):
			for j in range(n):
				for k in range(n):
					if i * 7 + j * 5 + k * 3 == n:
						s = str(k) + ' ' + str(j) + ' ' + str(i)
						return s
for _ in range(int(input())):
	n = int(input())
	print(f(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())
	ans = []
	if n % 3 == 0:
		ans = [n // 3, 0, 0]
	elif n % 5 == 0:
		ans = [0, n // 5, 0]
	elif n % 7 == 0:
		ans = [0, 0, n // 7]
	else:
		for i in range(1, 10):
			if n - 3 * i < 0:
				break
			if (n - 3 * i) % 5 == 0 and n - 3 * i >= 0:
				x = n - 3 * i
				ans = [i, x // 5, 0]
			elif (n - 7 * i) % 5 == 0 and n - 7 * i >= 0:
				x = n - 7 * i
				ans = [0, x // 5, i]
	if len(ans) > 0:
		for item in ans:
			print(item, end=' ')
		print('')
	else:
		print(-1)


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

	class BreakIt(Exception):
		pass
	try:
		for i in range(n):
			for j in range(n):
				for k in range(n):
					if i * 3 + j * 5 + k * 7 == n:
						r = r + 1
						raise BreakIt
	except BreakIt:
		pass
	if r == 0:
		print('-1')
	else:
		print(i, j, k)


import sys
input = sys.stdin.readline

def solve(n):
	for i in range(n // 7 + 1):
		for j in range(n // 5 + 1):
			if n - i * 7 - j * 5 >= 0 and (n - i * 7 - j * 5) % 3 == 0:
				return ((n - i * 7 - j * 5) // 3, j, i)
	return (-1, -1, -1)

def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		(a, b, c) = solve(n)
		if a == -1:
			print(-1)
		else:
			print(a, b, c)
main()


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())
lst = []
for i in range(0, n):
	ele = int(input())
	lst.append(ele)
a = 0
b = 0
c = 0
for i in lst:
	a = i // 15
	b = i // 15
	c = i // 15
	if i < 3:
		print('-1')
		continue
	if i % 15 == 1:
		a = 3
		c = 1
		b = (i // 15 - 1) * 3
	elif i % 15 == 2:
		a = 0
		b = 2
		c = 1
		b += (i // 15 - 1) * 3
	if i % 15 == 4:
		a = 4
		b = 0
		c = 1
		b += (i // 15 - 1) * 3
	if i % 15 == 3:
		a += 1
	elif i % 15 == 5:
		b += 1
	elif i % 15 == 7:
		c += 1
	elif i % 15 == 6:
		a += 2
	elif i % 15 == 8:
		a += 1
		b += 1
	elif i % 15 == 9:
		a += 3
	elif i % 15 == 10:
		b += 2
	elif i % 15 == 11:
		a += 2
		b += 1
	elif i % 15 == 12:
		a += 4
	elif i % 15 == 13:
		a += 2
		c += 1
	elif i % 15 == 14:
		c += 2
	elif i == 4:
		print('-1')
		continue
	print(a, b, c, sep=' ')


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]))


import sys

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

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

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	n = iinput()
	if n <= 2:
		print(-1)
	else:
		m = n // 2 + 1
		f = True
		for a in range(m):
			for b in range(m):
				for c in range(m):
					if a * 3 + b * 5 + c * 7 == n:
						f = False
						print(a, b, c)
						break
				if f == False:
					break
			if f == False:
				break
		if f == False:
			continue
		print(-1)


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


import sys, math
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	if n in [0, 1, 2, 4]:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif n % 3 == 1:
		n -= 7
		print(n // 3, 0, 1)
	elif n % 3 == 2:
		n -= 5
		print(n // 3, 1, 0)


from sys import stdin, stdout
import math
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n == 7:
		print('0 0 1')
	else:
		k = n // 3
		r = n % 3
		while k > -1:
			if r % 5 == 0:
				print(k, r // 5, 0)
				break
			else:
				k -= 1
				r += 3


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}')


for _ in range(int(input())):
	n = int(input())
	flag = True
	for a in range(n):
		if not flag:
			break
		for b in range(n):
			if not flag:
				break
			for c in range(n):
				if 3 * a + 5 * b + 7 * c == n:
					print(a, b, c)
					flag = False
					break
	if flag:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	flag = 0
	for three in range(0, n):
		for five in range(0, n):
			if (n - (three * 3 + five * 5)) % 7 == 0 and (n - (three * 3 + five * 5)) / 7 >= 0:
				flag = 1
				print(three, five, int((n - (three * 3 + five * 5)) / 7), sep=' ')
				break
		if flag == 1:
			break
	if flag == 1:
		continue
	print(-1)


def get_data():
	n = int(input())
	digits = []
	for i in range(n):
		digits.append(int(input()))
	return digits

def calc(data):
	for num in data:
		yes = False
		for x in range(num - 1):
			if yes:
				break
			for y in range(num - 1):
				if yes:
					break
				for z in range(num - 1):
					if 3 * x + 5 * y + 7 * z == num:
						print(x, y, z)
						yes = True
		if not yes:
			print(-1)
data = get_data()
calc(data)


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)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

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

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

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

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

def main():
	try:
		for _ in range(inp()):
			n = inp()
			(threes, fives, sevens) = (0, 0, 0)
			if n == 3:
				print('1 0 0')
			elif n == 4 or n < 3:
				print('-1')
			elif n == 5:
				print('0 1 0')
			elif n == 6:
				print('2 0 0')
			elif n == 7:
				print('0 0 1')
			elif n == 8:
				print('1 1 0')
			elif n == 9:
				print('3 0 0')
			elif n == 10:
				print('0 2 0')
			elif n % 7 == 0:
				sevens = n // 7
				print(threes, fives, sevens)
			elif n % 3 == 0:
				threes = n // 3
				print(threes, fives, sevens)
			elif n % 5 == 0:
				fives = n // 5
				print(threes, fives, sevens)
			elif n % 10 == 1 or n % 10 == 6:
				fives = (n - 6) // 5
				threes = 2
				print(threes, fives, sevens)
			elif n % 10 == 2 or n % 10 == 7:
				fives = (n - 7) // 5
				sevens = 1
				print(threes, fives, sevens)
			elif n % 10 == 4 or n % 10 == 9:
				fives = (n - 9) // 5
				threes = 3
				print(threes, fives, sevens)
			elif n % 10 == 7:
				fives = (n - 7) // 5
				sevens = 1
				print(threes, fives, sevens)
			elif n % 10 == 8 or n % 10 == 3:
				fives = (n - 3) // 5
				threes = 1
				print(threes, fives, sevens)
	except Exception as e:
		print(e)
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()


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)


test = int(input())
for i in range(test):
	n = int(input())
	if n < 3 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')


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])


ans = []
for i in range(int(input())):
	n = int(input())
	(a7, a5, a3) = (0, 0, 0)
	flag = False
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if n == i * 3 + j * 5 + k * 7:
					ans.append(str(i) + ' ' + str(j) + ' ' + str(k))
					flag = True
					break
			if flag == True:
				break
		if flag == True:
			break
	if flag == False:
		ans.append('-1')
for i in ans:
	print(i)


list = []
n = int(input())
for i in range(0, n):
	val = int(input())
	if val % 7 == 0:
		list.append('0 0 ' + str(int(val / 7)))
	else:
		index = 0
		while 1:
			div = (val + 2 * index) % 5
			if div == 0:
				break
			index += 1
		y = int((val - 3 * index) / 5)
		if y >= 0 and (val - 3 * index) % 5 == 0:
			list.append(str(index) + ' ' + str(y) + ' 0')
		else:
			list.append(str(-1))
print('\n'.join(list))


t = int(input())
arr_i = []
for i in range(t):
	arr_i.append(int(input()))
for j in arr_i:
	b_flag = False
	for a in range(j // 7 + 1):
		for b in range(j // 5 + 1):
			c = j - 7 * a - 5 * b
			if c % 3 == 0:
				b_flag = True
				print(c // 3, b, a)
			if b_flag:
				break
		if b_flag:
			break
	if not b_flag:
		print(-1)


from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	ans = [-1]
	for x in range(n):
		if ans != [-1]:
			break
		for y in range(n):
			v = n - 3 * x - 5 * y
			if v >= 0 and v % 7 == 0:
				ans = (x, y, v // 7)
	print(*(ans if ans is not None else -1))


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()


from math import ceil
from sys import stdin, stdout, setrecursionlimit
from random import randint
for _ in range(int(input())):
	n = int(input())
	c = False
	for i in range(3):
		if c:
			break
		for j in range(5):
			if (n - i * 5 - j * 7) % 3 == 0 and n - i * 5 - j * 7 >= 0:
				print((n - i * 5 - j * 7) // 3, i, j)
				c = True
				break
	if not c:
		print(-1)


for i in range(int(input())):
	n = int(input())
	c4 = 1
	i = 0
	j = 0
	if n == 7:
		print(0, 0, 1)
		continue
	elif n == 5:
		print(0, 1, 0)
		continue
	elif n == 3:
		print(1, 0, 0)
		continue
	while n > 0:
		if c4 == 0:
			break
		c = n
		while c > 0:
			if c % 3 == 0:
				c4 = 0
				print(c // 3, i, j)
				break
			else:
				c = c - 5
				i = i + 1
		n = n - 7
		i = 0
		j = j + 1
	if c4 == 1:
		print(-1)


def solve(n):
	k = 0
	for i in range(0, n // 3 + 1):
		for j in range(0, n // 3 + 1):
			k = (n - 3 * i - 5 * j) / 7
			if k % 1 == 0 and k >= 0:
				return str(i) + ' ' + str(j) + ' ' + str(int(k))
	return -1
t = int(input())
for i in range(t):
	print(solve(int(input())))


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]))


t = int(input())

def soln(a, b, n):
	i = 0
	while i * a <= n:
		if (n - i * a) % b == 0:
			print(i, int((n - i * a) / b), end=' ')
			return 1
		i = i + 1
	return 0
for i in range(t):
	f = 0
	n = int(input())
	f = 0
	for i in range(140):
		if soln(3, 5, n - i * 7):
			print(i)
			f = 1
			break
	if f == 0:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	res = ()
	for x in range(143):
		if not res:
			for y in range(200):
				if (n - 7 * x - 5 * y) % 3 == 0 and n - 7 * x - 5 * y >= 0:
					res = ((n - 7 * x - 5 * y) // 3, y, x)
					break
	if res:
		print(res[0], res[1], res[2])
	else:
		print(-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))


import sys
import heapq
import copy
import math
import decimal
input = sys.stdin.readline

def binary_exponentiation(a, b):
	ans = 1
	while b != 0:
		bit = b % 2
		if bit == 1:
			ans = ans * a
		a = a * a
		b = b // 2
	return ans

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

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

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

def insr2():
	s = input()
	s = list(s[:len(s) - 1])
	s = [ord(s[i]) - ord('a') for i in range(len(s))]
	return s

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

def pr_list(a):
	print(*a, sep=' ')

def swap(a, b):
	temp = a
	a = b
	b = temp
	return [a, b]

def pri(a, b):
	s = '? ' + str(a) + ' ' + str(b)
	print(s)
	sys.stdout.flush()
result = []

def nCk(arr, itr, k, n):
	if len(arr) == k:
		result.append(arr)
		return
	if len(arr) > k or itr == n + 1:
		return
	nCk(arr + [itr], itr + 1, k, n)
	nCk(arr, itr + 1, k, n)
	return

def nPk(arr, itr, k, n):
	if len(arr) == k:
		result.append(arr)
		return
	if len(arr) > k or itr == n + 1:
		return
	for i in range(len(arr) + 1):
		nPk(arr[0:i] + [itr] + arr[i:len(arr)], itr + 1, k, n)
	nPk(arr, itr + 1, k, n)
	return

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	arr = []
	heapq.heapify(arr)
	dp = [[] for i in range(1000 + 1)]
	dp[0] = [0, 0, 0]
	val = [3, 5, 7]
	for i in range(3):
		for k in range(1001):
			if dp[k] == [] and k - val[i] > 0 and (dp[k - val[i]] != []):
				dp[k] = copy.deepcopy(dp[k - val[i]])
				dp[k][i] = dp[k][i] + 1
			if dp[k] == [] and k % val[i] == 0:
				dp[k] = [0, 0, 0]
				dp[k][i] = k // val[i]
	for test in range(tests):
		n = inp()
		if dp[n] != []:
			pr_list(dp[n])
		else:
			print(-1)
main()


import sys
import math

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

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

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

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	boo = False
	ans = []
	for i in range(max(math.ceil(n / 3), 1) + 1):
		for j in range(max(math.ceil(n / 5), 1) + 1):
			if n - 3 * i - 5 * j >= 0 and (n - 3 * i - 5 * j) % 7 == 0:
				boo = True
				ans = [i, j, (n - 3 * i - 5 * j) // 7]
				break
		if boo:
			break
	if ans:
		print(*ans)
	elif n == 0:
		print(0, 0, 0)
	else:
		print(-1)


n = int(input())
for i in range(n):
	u = False
	windows = int(input())
	if windows < 3:
		print(-1)
		u = True
	if (windows % 3 == 0 or windows % 5 == 0 or windows % 7 == 0) and u == False:
		if windows % 3 == 0:
			print(int(windows / 3), 0, 0)
			u = True
		elif windows % 5 == 0:
			print(0, int(windows / 5), 0)
			u = True
		elif windows % 7 == 0:
			print(0, 0, int(windows / 7))
			u = True
	if u == False:
		(a3, a5, a7) = (0, 0, 0)
		while windows > 0:
			windows = windows - 3
			a3 += 1
			if windows % 5 == 0:
				a5 = int(windows / 5)
				windows = 0
				break
			elif windows % 7 == 0:
				a7 = int(windows / 7)
				windows = 0
				break
			elif windows <= 2:
				print(-1)
				u = True
				windows = 0
	if u:
		pass
	else:
		print(a3, a5, a7)


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.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(io.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', sys.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()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
T = int(input())
for _ in range(T):
	N = int(input())
	for i in range(150):
		for j in range(201):
			r = i * 7 + j * 5
			(k, m) = divmod(N - r, 3)
			if k >= 0 and m == 0:
				print(k, j, i)
				break
		else:
			continue
		break
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	q = n // 7
	flag = False
	for c in range(0, q + 1):
		t = n - 7 * c
		p = t // 5
		for b in range(0, p + 1):
			s = t - 5 * b
			if s % 3 == 0:
				print(s // 3, b, c)
				flag = True
				break
		else:
			continue
		break
	if not flag:
		print(-1)


for _ in range(int(input())):
	x = int(input())
	if x != 4 and x >= 3:
		cnt = 0
		thre = 0
		thre1 = 0
		fve = 0
		fve1 = 0
		svn = 0
		if x % 3 == 0:
			print(x // 3, 0, 0)
			continue
		elif x % 5 == 0:
			print(0, x // 5, 0)
			continue
		elif x % 7 == 0:
			print(0, 0, x // 7)
			continue
		if x > 7:
			y = int(x)
			cnt1 = 0
			while x > 0 and thre == 0 and (fve == 0) and (svn == 0):
				x = x - 7
				y = y - 5
				cnt += 1
				cnt1 += 1
				if x % 3 == 0:
					thre = 1
					break
				elif x % 5 == 0:
					fve = 1
					break
				if y % 3 == 0:
					thre1 = 1
					break
				elif y % 7 == 0:
					fve1 = 1
					break
			if thre == 1:
				print(x // 3, 0, cnt)
				continue
			elif fve == 1:
				print(0, x // 5, cnt)
				continue
			if thre1 == 1:
				print(y // 3, cnt1, 0)
			elif fve1 == 1:
				print(0, cnt1, y // 7)
			elif thre1 == 0 and fve1 == 0 and (thre == 0) and (fve == 0):
				print(-1)
	else:
		print(-1)


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)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 4 or n < 3:
		print(-1)
	else:
		try:
			for i in range(n // 3 + 1):
				ost = n - i * 3
				for j in range(ost // 5 + 1):
					lastost = ost - j * 5
					if lastost % 7 == 0:
						print(i, j, lastost // 7)
						raise ValueError()
		except ValueError:
			pass


data = {x: {3: 0, 7: 0, 5: 0} for x in range(1001)}
ost = 5
count_three = 0
data[1][3] = -1
data[1][5] = ''
data[1][7] = ''
data[2][3] = -1
data[2][5] = ''
data[2][7] = ''
data[3][3] = 1
data[4][3] = -1
data[4][5] = ''
data[4][7] = ''
data[5][5] = 1
for x in range(6, 1001):
	if ost == 5:
		ost = 6
		data[x][5] = 0
		data[x][3] = count_three + 2
		data[x][7] = 0
	elif ost == 6:
		ost = 7
		data[x][5] = 0
		data[x][3] = count_three
		data[x][7] = 1
	else:
		ost = 5
		count_three += 1
		data[x][5] = 1
		data[x][3] = count_three
		data[x][7] = 0
for _ in range(int(input())):
	n = int(input())
	print(data[n][3], data[n][5], data[n][7])


for t in range(int(input())):
	num = int(input())
	tlim = num // 3
	flim = num // 5
	slim = num // 7
	flag = 0
	for i in range(tlim + 1):
		for j in range(flim + 1):
			for k in range(slim + 1):
				if num == 3 * i + 5 * j + 7 * k:
					print(i, j, k)
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 0:
		print(-1)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 6)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict

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

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

def Neo():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	n = I()
	c = n // 7
	n -= c * 7
	(a, b) = (0, 0)
	if n == 0:
		print(0, 0, c)
		continue
	for i in range(6):
		c -= i
		k = i * 7 + n
		t = k // 3
		for j in range(t + 1):
			if j * 3 + (t - j) * 5 == k:
				(a, b) = (j, t - j)
				n = 0
				break
		if n == 0:
			break
	if n == 0 and c >= 0:
		print(a, b, c)
	else:
		print(-1)


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
t = int(input())
for i in range(t):
	n = int(input())
	if n == 4 or n == 1 or n == 2:
		print(-1)
	else:
		c5 = int(n / 10) * 2
		if n % 10 == 0:
			c3 = 0
			c7 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 1:
			c5 = max(0, c5 - 2)
			c3 = 2
			c5 = c5 + 1
			c7 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 2:
			c5 = max(0, c5 - 2)
			c3 = 4
			c7 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 3:
			c3 = 1
			c7 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 4:
			c5 = max(0, c5 - 2)
			c7 = 2
			c3 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 5:
			c5 = c5 + 1
			c3 = 0
			c7 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 6:
			c3 = 2
			c7 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 7:
			c7 = 1
			c3 = 0
			print(c3, c5, c7, sep=' ')
		if n % 10 == 8:
			c7 = 0
			c3 = 1
			c5 = c5 + 1
			print(c3, c5, c7, sep=' ')
		if n % 10 == 9:
			c7 = 0
			c3 = 3
			print(c3, c5, c7, sep=' ')


a = int(input())
for i in range(0, a):
	b = int(input())
	k = 0
	y = 0
	while k <= b / 3:
		p = 0
		while p <= b / 5:
			l = 0
			while l <= b / 7:
				if k * 3 + p * 5 + l * 7 == b:
					print(k, p, l)
					y = 1
					k = b / 3 + 1
					p = b / 5 + 1
					l = b / 7 + 1
				l = l + 1
			p = p + 1
		k = k + 1
	if y == 0:
		print(-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
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for _ in range(ii()):
	n = ii()
	if n < 3 or n == 4:
		print(-1)
	elif n % 10 == 0 or n % 10 == 5:
		print(0, n // 5, 0)
	elif n % 10 == 1:
		print(2, (n - 6) // 5, 0)
	elif n % 10 == 2:
		print(4, (n - 12) // 5, 0)
	elif n % 10 == 3:
		print(1, (n - 3) // 5, 0)
	elif n % 10 == 4:
		print(0, (n - 14) // 5, 2)
	elif n % 10 == 6:
		print(2, (n - 6) // 5, 0)
	elif n % 10 == 7:
		print(0, (n - 7) // 5, 1)
	elif n % 10 == 8:
		print(1, (n - 3) // 5, 0)
	elif n % 10 == 9:
		print(3, (n - 9) // 5, 0)


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)


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	can = False
	for i in range(n):
		if can:
			break
		if i * 7 > n:
			break
		for j in range(n):
			if can:
				break
			if j * 5 > n:
				break
			if (n - i * 7 - j * 5) % 3 == 0:
				print((n - i * 7 - j * 5) // 3, j, i)
				can = True
	if not can:
		print('-1')


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)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
input = stdin.readline
for _ in range(int(input())):
	x = int(input())
	a = -1
	b = -1
	c = -1
	for i in range(1000):
		if i * 7 > x:
			break
		for g in range(1000):
			if i * 7 + g * 5 > x:
				break
			if (x - i * 7 - g * 5) % 3:
				continue
			a = i
			b = g
			c = (x - i * 7 - g * 5) // 3
	if a == -1:
		print(a)
	else:
		print(c, b, a)


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)


t = int(input())
while t:
	t -= 1
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		k = n % 3
		i = k + 3
		d5 = 0
		d7 = 0
		while i < n:
			if i % 5 == 0:
				d5 = i // 5
				break
			elif i % 7 == 0:
				d7 = i // 7
				break
			else:
				i += 3
		if d5 == 0 and d7 == 0:
			print(-1)
		else:
			print((n - i) // 3, d5, d7)


for _ in range(int(input())):
	n = int(input())
	keep = True
	if n % 3 != 0 and n % 5 != 0 and (n % 7 != 0):
		x = n - 0
		result = 0
		while x >= 3:
			x = x - 3
			result += 1
			if x % 5 == 0:
				print(result, int(x / 5), 0)
				keep = False
				break
			elif x % 7 == 0:
				keep = False
				print(result, 0, int(x / 7))
				break
		result = 0
		while keep is True and x >= 5:
			x = x - 5
			result += 1
			if x % 3 == 0:
				print(int(x / 5), result, 0)
				break
			elif x % 7 == 0:
				print(result, 0, int(x / 7))
				break
		result = 0
		while keep is True and x >= 7:
			x = x - 7
			result += 1
			if x % 3 == 0:
				print(int(x / 5), 0, result)
				break
			elif x % 5 == 0:
				print(0, int(x / 7), result)
				break
		if keep is True:
			print(-1)
	elif n % 3 == 0:
		print(int(n / 3), 0, 0)
	elif n % 5 == 0:
		print(0, int(n / 5), 0)
	elif n % 7 == 0:
		print(0, 0, int(n / 7))


import math
t = int(input())
array = [int(input()) for i in range(t)]
result = [[] for i in array]
for case in range(t):
	sum = 0
	for i in range(array[case]):
		for j in range(array[case]):
			for k in range(array[case]):
				sum = i * 3 + j * 5 + k * 7
				if sum == array[case]:
					result[case] = [i, j, k]
					break
			if sum == array[case]:
				break
		if sum == array[case]:
			break
	if sum != array[case]:
		result[case] = [-1]
for i in result:
	print(*i)


d57 = dict()
for (i, ii) in enumerate(range(0, 1001, 5)):
	for (j, jj) in enumerate(range(0, 1001, 7)):
		if ii + jj <= 1000:
			d57[ii + jj] = (i, j)
for t in range(int(input())):
	n = int(input())
	for (i, ii) in enumerate(range(0, n + 1, 3)):
		if n - ii in d57:
			print(i, *d57[n - ii])
			break
	else:
		print(-1)


for test in range(int(input())):
	n = int(input())
	if n % 10 == 0:
		print(0, n // 5, 0)
		continue
	tuu = [(0, 0, 0), (2, 1, 0), (4, 0, 0), (1, 2, 0), (0, 0, 2), (0, 1, 0), (2, 0, 0), (0, 0, 1), (1, 1, 0), (3, 0, 0)]
	rem = n % 10
	quo = n // 10
	if rem == 3 and quo == 0:
		print(1, 0, 0)
		continue
	t = tuu[rem]
	if rem >= 5:
		print(t[0], t[1] + quo * 2, t[2])
	elif quo >= 1:
		print(t[0], t[1] + quo * 2 - 2, t[2])
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	count = [0 for x in range(3)]
	if n in [1, 2, 4]:
		print(-1)
		continue
	elif n % 3 == 0:
		count[0] = n // 3
	elif (n - 5) % 3 == 0:
		count[0] = (n - 5) // 3
		count[1] = 1
	elif (n - 7) % 3 == 0:
		count[0] = (n - 7) // 3
		count[2] = 1
	for a in count:
		print(a, end=' ')
	print(' ')


t = int(input())
for ti in range(t):
	fl = False
	n = int(input())
	max7 = n // 7
	for k7 in range(0, max7 + 1):
		max5 = (n - k7 * 7) // 5
		for k5 in range(0, max5 + 1):
			o3 = n - k7 * 7 - k5 * 5
			k3 = o3 // 3
			if k3 == o3 / 3 and k3 >= 0 and (n == k3 * 3 + k5 * 5 + k7 * 7):
				print(k3, k5, k7)
				fl = True
				break
		if fl:
			break
	else:
		print(-1)


def x(n):
	d = []
	for i in range(1 + n // 3):
		for j in range(1 + n // 5):
			for k in range(1 + n // 7):
				if 3 * i + 5 * j + 7 * k == n:
					d.append(str(i))
					d.append(str(j))
					d.append(str(k))
					return d
	d.append('-1')
	return d
t = int(input())
for _ in range(t):
	n = int(input())
	ans = x(n)
	print(' '.join(ans))


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()


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(-1)
	elif n == 4:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		count = 0
		while n % 5 != 0 and n % 7 != 0 and (n > 1):
			count += 1
			n -= 3
		if n % 5 == 0:
			print(count, n // 5, 0)
		elif n % 7 == 0:
			print(count, 0, n // 7)
		else:
			print(-1)


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


def check(n):
	for x in range(n // 3 + 1):
		for y in range(n // 5 + 1):
			for z in range(n // 7 + 1):
				if 3 * x + 5 * y + 7 * z == n:
					return [x, y, z]
	return [-1]
for _ in range(int(input())):
	n = int(input())
	print(*check(n))


def no_rooms(n):
	if n % 3 == 0:
		return [n // 3, 0, 0]
	elif n % 5 == 0:
		return [0, n // 5, 0]
	elif n % 7 == 0:
		return [0, 0, n // 7]
	else:
		for i in range(0, n // 3 + 1):
			for j in range(0, n // 5 + 1):
				for k in range(0, n // 7 + 1):
					if i * 3 + j * 5 + k * 7 == n:
						return [i, j, k]
		return [-1]
test = int(input())
for i in range(test):
	n = int(input())
	out = no_rooms(n)
	print(' '.join(map(str, out)))


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)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	for i in range(145):
		for j in range(200):
			if n - (7 * i + 5 * j) >= 0 and (n - (7 * i + 5 * j)) % 3 == 0:
				k = (n - (7 * i + 5 * j)) // 3
				print(k, j, i)
				break
		else:
			continue
		break
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	a1 = 0
	a2 = 0
	a3 = 0
	if n % 3 == 0:
		a1 = n // 3
	elif n % 5 == 0:
		a2 = n // 5
	elif n % 7 == 0:
		a3 = n // 7
	else:
		a4 = n % 3
		if a4 == 2:
			a1 = (n - 5) // 3
			a2 = 1
		else:
			a1 = (n - 7) // 3
			a3 = 1
	if n == 4 or n < 3:
		print(-1)
	else:
		print(a1, a2, a3)


import sys
input = sys.stdin.readline

def solve(n):
	for a in range(n // 3 + 1):
		nr = n - a * 3
		for b in range(nr // 5 + 1):
			nr2 = nr - 5 * b
			if nr2 % 7 == 0:
				print(a, b, nr2 // 7)
				return
	print(-1)
for _ in range(int(input())):
	n = int(input())
	solve(n)


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)


from itertools import *
for _ in ' ' * int(input()):
	n = int(input())
	for (a, b, c) in product(range(n // 3 + 1), repeat=3):
		if a * 3 + b * 5 + c * 7 == n:
			print(a, b, c)
			break
	else:
		print(-1)


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)


def func(n):
	for a in range(n // 3 + 1):
		for b in range(n // 5 + 1):
			c = (n - 3 * a - 5 * b) / 7
			if float(int(c)) == c:
				return (a, b, int(c))
	return [-1]
for _ in range(int(input())):
	a = list(func(int(input())))
	print(*a, sep=' ')


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)


def answer(n):
	for i in range(0, 350):
		for j in range(0, 205):
			x = i * 3 + j * 5
			if n - x >= 0 and (n - x) % 7 == 0:
				return [i, j, (n - x) // 7]
	return [-1]
t = int(input())
for i in range(t):
	n = int(input())
	print(*answer(n))


t = int(input(''))
for j in range(t):
	n = int(input(''))
	if n % 3 == 0:
		print(n // 3, 0, 0)
		continue
	elif n % 5 == 0:
		print(0, n // 5, 0)
		continue
	elif n % 7 == 0:
		print(0, 0, n // 7)
		continue
	for i in range(1, 6):
		ten3 = n - i * 3
		if ten3 < 0:
			print(-1)
			break
		if ten3 % 5 == 0:
			print(i, ten3 // 5, 0)
			break
		elif ten3 % 7 == 0:
			print(i, 0, ten3 // 7)
			break


for _ in ' ' * int(input()):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		f = 0
		j = 1
		while n - j * 7 >= 0:
			x = n - j * 7
			if x % 3 == 0:
				print(x // 3, 0, j)
				f = 1
				break
			elif x % 5 == 0:
				print(0, x // 5, j)
				f = 1
				break
			else:
				j += 1
		j = 1
		if f == 0:
			while n - j * 3 >= 0:
				x = n - j * 3
				if x % 5 == 0:
					print(j, x // 5, 0)
					f = 1
					break
				elif x % 7 == 0:
					print(j, 0, x // 7)
					f = 1
					break
				else:
					j += 1
		j = 1
		if f == 0:
			while n - j * 5 >= 0:
				x = n - j * 5
				if x % 3 == 0:
					print(x // 3, j, 0)
					f = 1
					break
				elif x % 7 == 0:
					print(0, j, x // 7)
					f = 1
					break
				else:
					j += 1
		if f == 0:
			print(-1)


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)


import sys
input = sys.stdin.readline

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

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

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

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

def solve():
	n = inp()
	for z in range(1000):
		if 7 * z > n:
			continue
		for y in range(1000):
			if 7 * z + 5 * y > n:
				continue
			potentialX = (n - 7 * z - 5 * y) / 3
			if potentialX.is_integer():
				return '{} {} {}'.format(int(potentialX), y, z)
	return -1
t = inp()
while t > 0:
	print(solve())
	t -= 1


for _ in range(int(input())):
	N = int(input())
	if N == 1 or N == 2 or N == 4:
		print(-1)
	elif N == 5:
		print(0, 1, 0)
	elif N == 8:
		print(1, 1, 0)
	elif N == 11:
		print(2, 1, 0)
	elif N % 3 == 0:
		print(N // 3, 0, 0)
	elif N % 3 == 1:
		print((N - 7) // 3, 0, 1)
	elif N % 3 == 2:
		print((N - 14) // 3, 0, 2)


test = int(input())
for i in range(test):
	n = int(input())
	a = [1, 2, 4]
	q = [3, 5, 7]
	if n in a:
		print(-1)
	else:
		ans = [0] * 3
		j = 1
		while True:
			if n % 3 == 0:
				ans[0] = n // 3
				break
			if n % 7 == 0:
				ans[2] = n // 7
				break
			if n % 5 == 0:
				ans[1] = n // 5
				break
			if (n - 3 * j) % 5 == 0:
				ans[0] = j
				ans[1] = (n - 3 * j) // 5
				ans[2] = 0
				break
			if (n - 3 * j) % 7 == 0:
				ans[0] = j
				ans[2] = (n - 3 * j) // 7
				ans[1] = 0
				break
			if (n - 7 * j) % 3 == 0:
				ans[2] = j
				ans[0] = (n - 7 * j) // 3
				ans[1] = 0
				break
			if (n - 7 * j) % 5 == 0:
				ans[2] = j
				ans[1] = (n - 7 * j) // 5
				ans[0] = 0
				break
			if (n - 5 * j) % 3 == 0:
				ans[1] = j
				ans[0] = (n - 5 * j) // 3
				ans[2] = 0
				break
			if (n - 5 * j) % 7 == 0:
				ans[1] = j
				ans[2] = (n - 5 * j) // 7
				ans[0] = 0
				break
			j += 1
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	c = 0
	for i in range(350):
		for j in range(210):
			l = n - i * 3 - j * 5
			if l % 7 == 0 and l >= 0:
				print(i, j, l // 7)
				c = 1
				break
		if c:
			break
	if c == 0:
		print(-1)


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()


s = (1, 2, 4)
t = int(input())
for _ in range(t):
	n = int(input())
	if n in s:
		print(-1)
		continue
	(a, b, c, d) = (n % 3, n % 5, n % 7, n % 8)
	rem = n // 8
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif n % 8 == 0:
		rem = n // 8
		print(rem, rem, 0)
	elif n % 3 == 2:
		print(n // 3 - 1, 1, 0)
	elif n % 3 == 1:
		print(n // 3 - 2, 0, 1)
	elif n % 5 == 1 and n != 1:
		print(2, n // 5 - 1, 0)
	elif b % 3 == 0:
		print(b // 3, n // 5, 0)
	elif c % 3 == 0:
		print(c // 3, 0, n // 7)
	elif c % 5 == 0:
		print(0, c // 5, n // 7)
	elif d % 3 == 0:
		print(rem + d // 3, rem, 0)
	elif d % 5 == 0:
		print(rem, rem + d // 5, 0)
	elif d % 7 == 0:
		print(rem, 5 * rem, d // 7)
	else:
		print(-1)


max_n = 1200
answers = [-1, -1, -1, '3', -1, '5', '33', '7'] + [-1 for _ in range(max_n + 20)]
for i in range(max_n):
	current_case = answers[i]
	if current_case == -1:
		continue
	else:
		next_3 = answers[i + 3]
		next_5 = answers[i + 5]
		next_7 = answers[i + 7]
		if next_3 == -1:
			answers[i + 3] = current_case + '3'
		if next_5 == -1:
			answers[i + 5] = current_case + '5'
		if next_7 == -1:
			answers[i + 7] = current_case + '7'

def print_answer(x):
	if isinstance(x, int):
		return '-1'
	count_3 = x.count('3')
	count_5 = x.count('5')
	count_7 = x.count('7')
	return f'{count_3} {count_5} {count_7}'
t = int(input())
outputs = []
for _ in range(t):
	n = int(input())
	outputs.append(print_answer(answers[n]))
for output in outputs:
	print(output)


def process():
	n = int(input())
	for i in range(0, n // 3 + 1):
		for j in range(0, (n - 3 * i) // 5 + 1):
			if (n - (3 * i + 5 * j)) % 7 == 0:
				print(i, j, (n - (3 * i + 5 * j)) // 7)
				return
	print(-1)
tests = int(input())
for i in range(tests):
	process()


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	ok = False
	for c3 in range(n + 1):
		for c5 in range(n + 1):
			rem = n - c3 * 3 - c5 * 5
			if rem % 7 or rem < 0:
				continue
			else:
				print(c3, c5, rem // 7)
				ok = True
				break
		if ok:
			break
	if not ok:
		print(-1)


n_in = int(input())

def solve(d):
	(a, b, c) = (0, 0, 0)
	if d >= 15:
		d -= 15
		b += 3
		a += d // 3
		d = d % 3
		if d == 0:
			return (a, b, c)
		return (a + 2 * d, b - d, c)
	for a in range(5):
		for b in range(3):
			for c in range(3):
				if 3 * a + 5 * b + 7 * c == d:
					return (a, b, c)
for _ in range(n_in):
	d = int(input())
	r = solve(d)
	if r:
		print(*r)
	else:
		print(-1)


import sys
read = lambda : sys.stdin.readline().strip()
readi = lambda : map(int, read().split())
from collections import *
from math import *

def main():
	n = int(read())
	temp = 0
	for three in range(334):
		for five in range(201):
			for seven in range(143):
				temp = three * 3 + five * 5 + seven * 7
				if temp == n:
					print(three, five, seven)
					return
				if temp > n:
					break
	print(-1)
for _ in range(int(read())):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	u = 0
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		for i in range(n + 1):
			for j in range(n + 1):
				for k in range(n + 1):
					z = 7 * i + 5 * j + 3 * k
					if z == n:
						print(k, j, i)
						u = 1
						break
				if u == 1:
					break
			if u == 1:
				break
		else:
			print(-1)


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


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)


l = []
for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		l.append(-1)
	elif n % 7 == 0:
		l.append(' '.join(['0', '0', str(n // 7)]))
	elif n % 7 == 1:
		l.append(' '.join(['1', '1', str(n // 7 - 1)]))
	elif n % 7 == 2:
		l.append(' '.join(['3', '0', str(n // 7 - 1)]))
	elif n % 7 == 3:
		l.append(' '.join(['1', '0', str(n // 7)]))
	elif n % 7 == 4:
		l.append(' '.join(['2', '1', str(n // 7 - 1)]))
	elif n % 7 == 5:
		l.append(' '.join(['0', '1', str(n // 7)]))
	else:
		l.append(' '.join(['2', '0', str(n // 7)]))
for i in l:
	print(i)


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)


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for tt in range(t):
	n = int(input())
	ans = False
	for i in range(n // 7 + 1):
		for j in range(n // 5 + 1):
			num = n - 7 * i - 5 * j
			if num < 0:
				continue
			if num % 3 == 0:
				ans = True
				print(num // 3, j, i)
				break
		else:
			continue
		break
	if not ans:
		print(-1)


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()


def chk(n):
	(x, y, z) = (n // 3, n // 5, n // 7)
	for i in range(x + 1):
		for j in range(y + 1):
			for k in range(z + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return [i, j, k]
	return [-1]
for t in range(int(input())):
	n = int(input())
	print(*chk(n))


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 math
t = int(input())
l = []
for _ in range(t):
	l.append(int(input()))
for each in l:
	sevens = math.floor(each / 7)
	fives = 0
	threes = 0
	total = sevens * 7
	if each == 11:
		print('2 1 0')
	elif each == 6:
		print('2 0 0')
	elif each == 5:
		print('0 1 0')
	elif each == 3:
		print('1 0 0')
	else:
		while total < each:
			if total < 0:
				print(-1)
				break
			elif (each - total) % 8 == 0:
				threes += 1 * ((each - total) / 8)
				fives += 1 * ((each - total) / 8)
				total = threes * 3 + fives * 5 + sevens * 7
			elif (each - total) % 6 == 0:
				threes += 2 * ((each - total) / 6)
				total = threes * 3 + fives * 5 + sevens * 7
			elif (each - total) % 5 == 0:
				fives += 1 * ((each - total) / 5)
				total = threes * 3 + fives * 5 + sevens * 7
			elif (each - total) % 3 == 0:
				threes += 1 * ((each - total) / 3)
				total = threes * 3 + fives * 5 + sevens * 7
			else:
				sevens += -1
				total += -7
		if total == each:
			print(int(threes), int(fives), int(sevens))


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

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

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

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	x = inp()
	l = [[0, 0, 0]] * 1002
	l[3] = [1, 0, 0]
	l[5] = [0, 1, 0]
	l[7] = [0, 0, 1]
	for i in range(3, 1002):
		if l[i] == [0, 0, 0]:
			continue
		if i + 3 < 1002:
			l[i + 3] = [l[i][0] + 1, l[i][1], l[i][2]]
		if i + 5 < 1002:
			l[i + 5] = [l[i][0], l[i][1] + 1, l[i][2]]
		if i + 7 < 1002:
			l[i + 7] = [l[i][0], l[i][1], l[i][2] + 1]
	if l[x] == [0, 0, 0]:
		print(-1)
	else:
		res = ''
		for y in l[x]:
			res += str(y) + ' '
		print(res)


class Solution:

	def __init__(self, n):
		self.n = n

	def solve(self):
		if self.n < 3 or self.n == 4:
			return [-1]
		if self.n % 7 == 0:
			return [0, 0, self.n // 7]
		if self.n % 7 == 1:
			return [1, 1, self.n // 7 - 1]
		if self.n % 7 == 2:
			return [3, 0, self.n // 7 - 1]
		if self.n % 7 == 3:
			return [1, 0, self.n // 7]
		if self.n % 7 == 4:
			return [2, 1, self.n // 7 - 1]
		if self.n % 7 == 5:
			return [0, 1, self.n // 7]
		if self.n % 7 == 6:
			return [2, 0, self.n // 7]
t = int(input())
for _ in range(t):
	n = int(input())
	s = Solution(n)
	ans = s.solve()
	for a in ans:
		print(a, end=' ')
	print()


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)


n = int(input())
box = []
loop = True
for num in range(n):
	windows = int(input())
	sign = 0
	if windows % 3 == 0:
		print(f'{windows // 3} 0 0')
		sign += 1
	elif windows % 5 == 0:
		print(f'0 {windows // 5}  0')
		sign += 1
	elif windows % 7 == 0:
		print(f'0 0 {windows // 7}')
		sign += 1
	else:
		for (num1, num2, num3) in ((num1, num2, num3) for num1 in range(windows // 3 + 1) for num2 in range(windows // 5 + 1) for num3 in range(windows // 7 + 1)):
			if 3 * num1 + 5 * num2 + 7 * num3 == windows:
				print(f'{num1} {num2} {num3}')
				sign += 1
				break
	if sign == 0:
		print('-1')


def solve(n):
	if n % 3 == 0:
		return [n // 3, 0, 0]
	if n % 5 == 0:
		return [0, n // 5, 0]
	if n % 7 == 0:
		return [0, 0, n // 7]
	p = n % 7
	if p == 5:
		return [0, 1, n // 7]
	if p % 3 == 0:
		return [p // 3, 0, n // 7]
	g = n - (n // 7 - 1) * 7
	if g == 8:
		return [1, 1, n // 7 - 1]
	if g == 9:
		return [3, 0, n // 7 - 1]
	if g == 10:
		return [0, 2, n // 7 - 1]
	if g == 11:
		return [2, 1, n // 7 - 1]
	return [-1]
for _ in range(int(input())):
	n = int(input())
	f = True
	for j in solve(n):
		if j < 0:
			f = False
			break
	if f:
		print(*solve(n))
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	c = 0
	if n % 3 == 0:
		a += n // 3
		print(str(a), ' ' + str(b), ' ' + str(c))
	else:
		while n > 0:
			if n % 5 == 0:
				b += n // 5
				print(str(a), ' ' + str(b), ' ' + str(c))
				break
			elif n % 7 == 0:
				c += n // 7
				print(str(a), ' ' + str(b), ' ' + str(c))
				break
			n -= 3
			a += 1
		else:
			print('-1')


from sys import stdin, stdout
for _ in range(int(input())):
	n = int(input())
	if n == 3:
		print(1, 0, 0)
		continue
	(x3, x5, x7) = (0, 0, 0)
	flag = False
	while x3 * 3 <= n:
		cnt = n - x3 * 3
		(x5, x7) = (0, 0)
		while x5 * 5 <= cnt:
			cnt1 = cnt - x5 * 5
			x7 = 0
			if cnt1 % 7 == 0:
				flag = True
				x7 = cnt1 // 7
				break
			x5 += 1
		if flag:
			break
		x3 += 1
	if flag:
		print(x3, x5, x7)
	else:
		print(-1)


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)


for _ in ' ' * int(input()):
	a = int(input())
	ok = 0
	for i in range(0, 1007 // 7):
		for j in range(0, 1007 // 5):
			if a - i * 7 - j * 5 >= 0 and (a - i * 7 - j * 5) % 3 == 0:
				print((a - i * 7 - j * 5) // 3, j, i)
				ok = 1
				break
		if ok:
			break
	if ok == 0:
		print(-1)


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


for _ in range(int(input())):
	n = int(input())
	bool = False
	for i in range(145):
		for j in range(200):
			for k in range(350):
				ans = 7 * i + 5 * j + 3 * k
				if ans == n:
					print(k, j, i)
					bool = True
					break
				if 7 * i > n:
					break
			if bool:
				break
		if bool:
			break
	if not bool:
		print(-1)


t = int(input())
cases = []
for i in range(t):
	n = int(input())
	cases.append(n)
for n in cases:
	(i, j, k) = (0, 0, 0)
	ok = False
	while i <= n // 7 and (not ok):
		j = 0
		while j <= (n - i * 7) // 5 and (not ok):
			k = 0
			while k <= (n - i * 7 - j * 5) // 3 and (not ok):
				number = n - 7 * i - 5 * j - 3 * k
				if number % 7 == 0:
					i += number // 7
					ok = True
					break
				if number % 5 == 0:
					j += number // 5
					ok = True
					break
				if number % 3 == 0:
					k += number // 3
					ok = True
					break
				guess = 7 * i + 5 * j + 3 * k
				if guess == n:
					ok = True
					break
				k += 1
			if ok:
				break
			j += 1
		if ok:
			break
		i += 1
	if ok:
		print(str(k) + ' ' + str(j) + ' ' + str(i))
	else:
		print(-1)


for i in range(int(input())):
	m = int(input())
	t = 0
	for a in range(m // 3 + 1):
		for b in range(m // 5 + 1):
			for c in range(m // 7 + 1):
				if a * 3 + b * 5 + c * 7 == m:
					print(a, b, c)
					t = 1
					break
			if t == 1:
				break
		if t == 1:
			break
	if t != 1:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	f = False
	for i in range(n // 7 + 1):
		k = n - i * 7
		if k < 0:
			break
		for j in range(k // 5 + 1):
			m = k - j * 5
			if m < 0:
				break
			if m % 3 == 0:
				print(m // 3, j, i)
				f = True
				break
		if f:
			break
	else:
		print(-1)


def solve(n):
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return [i, j, k]
	return 0
for _ in range(int(input())):
	n = int(input())
	soln = solve(n)
	if soln:
		print(' '.join([str(i) for i in soln]))
	else:
		print(-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 d4c(n):
	if n == 3:
		return ['1', '0', '0']
	if n <= 4:
		return ['-1']
	for i in range(n):
		for j in range(n):
			for k in range(n):
				if i * 7 + j * 5 + k * 3 == n:
					return [str(k), str(j), str(i)]
for _ in range(int(input())):
	print(' '.join(d4c(int(input()))))


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()


def get_lower_20(n):
	if n == 3:
		return (1, 0, 0)
	if n == 5:
		return (0, 1, 0)
	if n == 6:
		return (2, 0, 0)
	if n == 7:
		return (0, 0, 1)
	if n == 8:
		return (1, 1, 0)
	if n == 9:
		return (3, 0, 0)
	if n == 10:
		return (0, 2, 0)
	if n == 11:
		return (2, 1, 0)
	if n == 12:
		return (4, 0, 0)
	if n == 13:
		return (1, 2, 0)
	if n == 14:
		return (0, 0, 2)
	if n == 15:
		return (0, 3, 0)
	if n == 16:
		return (2, 2, 0)
	if n == 17:
		return (0, 2, 1)
	if n == 18:
		return (1, 3, 0)
	if n == 19:
		return (3, 2, 0)
	if n == 20:
		return (0, 4, 0)
	raise Exception('unknown ' + str(n))

def solve(n):
	if n < 3 or n == 4:
		return (False, 0, 0, 0)
	(k_3, k_5, k_7) = (0, 0, 0)
	if n < 20:
		(k_3, k_5, k_7) = get_lower_20(n)
	else:
		count_10 = int(n / 10) - 1
		k_5 = 2 * count_10
		(k_3_, k_5_, k_7_) = get_lower_20(n - count_10 * 10)
		k_3 += k_3_
		k_7 += k_7_
		k_5 += k_5_
	return (True, k_3, k_5, k_7)
t = int(input())
for _ in range(t):
	n = int(input())
	(is_success, a, b, c) = solve(n)
	if not is_success:
		print(-1)
	else:
		assert a * 3 + b * 5 + c * 7 == n, '!!! ' + str(n) + ' {} {} {}'.format(str(a), str(b), str(c))
		print('{} {} {}'.format(str(a), str(b), str(c)))


from sys import stdin
casos = int(stdin.readline().strip())
for caso in range(casos):
	x = int(stdin.readline().strip())
	t = False
	for i in range(10000):
		if i * 7 > x:
			break
		for j in range(100000):
			y = 7 * i + 5 * j
			if y <= x and (x - y) % 3 == 0:
				print((x - y) // 3, j, i)
				t = True
				break
			if j * 5 > x:
				break
		if t:
			break
	if not t:
		print(-1)


def func(n):
	if n < 4 and n != 3:
		return [-1]
	for i in range(0, 200):
		for j in range(0, 200):
			for k in range(0, 200):
				ans = i * 3 + j * 5 + k * 7
				if ans > n:
					break
				if ans == n:
					return [i, j, k]
	return [-1]
for _ in range(int(input())):
	n = int(input())
	print(*func(n))


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')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		if n % 3 == 1:
			if n == 1 or n == 4:
				print(-1)
			else:
				print((n - 7) // 3, 0, 1)
		if n % 3 == 2:
			if n == 2:
				print(-1)
			else:
				print((n - 5) // 3, 1, 0)


n = int(input())
for _ in range(n):
	num_windows = int(input())
	memo = [None for _ in range(num_windows + 1)]
	memo[0] = [0, 0, 0]
	c = (3, 5, 7)
	for i in range(num_windows):
		if memo[i] is None:
			continue
		for (j, a) in enumerate(c):
			if i + a <= num_windows and memo[i + a] is None:
				memo[i + a] = memo[i].copy()
				memo[i + a][j] += 1
	if memo[num_windows]:
		print(' '.join((str(x) for x in memo[num_windows])))
	else:
		print(-1)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	f = 0
	for i in range(300):
		for j in range(300):
			s = i * 7 + j * 5
			if s <= n:
				if (n - s) % 3 == 0:
					print((n - s) // 3, j, i)
					f = 1
					break
		if f == 1:
			break
	else:
		print(-1)


import bisect, math

def foo(n):
	mx = n // 3 + 1
	for i in range(mx):
		for j in range(mx):
			v = i * 3 + j * 7
			if v <= n and (n - v) % 5 == 0:
				return (i, int((n - v) // 5), j)
	return (-1,)
t = int(input())
for _ in range(t):
	n = int(input())
	print(' '.join(map(str, foo(n))))


def olve():
	n = int(input())
	f = 0
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			if (n - 3 * i - 5 * j) % 7 == 0 and n - 3 * i - 5 * j >= 0:
				f = 1
				print(i, j, (n - 3 * i - 5 * j) // 7)
				return
	print(-1)
for testis in range(int(input())):
	olve()


for _ in range(int(input())):
	ans = []
	t = int(input())
	for i in range(1000):
		if ans != []:
			break
		for j in range(1000):
			if 3 * i + 5 * j > t:
				break
			if ans != []:
				break
			for k in range(1000):
				if 3 * i + 5 * j + 7 * k > t:
					break
				elif 3 * i + 5 * j + 7 * k == t:
					ans.append(i)
					ans.append(j)
					ans.append(k)
					break
	if not ans:
		print(-1)
	else:
		print(' '.join(map(str, ans)))


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


import sys
a = int(sys.stdin.readline())

def f(x, s):
	global o
	if s == n:
		print(v[2], v[1], v[0])
		o = 1
		return
	if x == 3:
		return
	v[x] = 0
	while 1:
		if s + r[x] * v[x] <= n and o == 0:
			f(x + 1, s + r[x] * v[x])
			v[x] += 1
		else:
			v[x] = 0
			return
for x in range(a):
	n = int(sys.stdin.readline())
	r = [7, 5, 3]
	v = [0, 0, 0]
	o = 0
	f(0, 0)
	if o == 0:
		print(-1)


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)


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


def count_flats(n):
	if n == 0:
		return [0, 0, 0]
	if n >= 7:
		a = count_flats(n - 7)
		if a is not None:
			a[2] += 1
			return a
	if n >= 5:
		a = count_flats(n - 5)
		if a is not None:
			a[1] += 1
			return a
	if n >= 3:
		a = count_flats(n - 3)
		if a is not None:
			a[0] += 1
			return a
	return
for i in range(int(input())):
	res = count_flats(int(input()))
	if res is None:
		print(-1)
	else:
		print(' '.join([str(i) for i in res]))


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)


for i in range(int(input())):
	n = int(input())
	x = 0
	(a, b, c) = (0, 0, 0)
	for i in range(n + 1):
		for j in range(n + 1):
			for k in range(n + 1):
				if 3 * i + 5 * j + 7 * k == n:
					(a, b, c) = (i, j, k)
					x = 1
					break
			if x == 1:
				break
		if x == 1:
			break
	if a == 0 and b == 0 and (c == 0):
		print(-1)
	else:
		print(a, b, c)


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


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
mx = 1005
dp = [[-1] * 3 for _ in range(mx)]
dp[0] = [0, 0, 0]
for i in range(mx):
	(c3, c5, c7) = dp[i]
	if c3 == -1:
		continue
	for d in [3, 5, 7]:
		if i + d >= mx:
			continue
		if dp[i + d][0] != -1:
			continue
		if d == 3:
			dp[i + d] = [c3 + 1, c5, c7]
		if d == 5:
			dp[i + d] = [c3, c5 + 1, c7]
		if d == 7:
			dp[i + d] = [c3, c5, c7 + 1]
for _ in range(II()):
	n = II()
	if dp[n][0] == -1:
		print(-1)
	else:
		print(*dp[n])


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

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

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

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

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10
	A = 10
	n = random.randint(1, N)
	a = [random.randint(1, A) for i in range(n)]
	return (n, a)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()

class UnionFind:

	def __init__(self, n):
		self.table = [-1] * n

	def _root(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self._root(self.table[x])
			return self.table[x]

	def find(self, x, y):
		return self._root(x) == self._root(y)

	def union(self, x, y):
		r1 = self._root(x)
		r2 = self._root(y)
		if r1 == r2:
			return
		d1 = self.table[r1]
		d2 = self.table[r2]
		if d1 <= d2:
			self.table[r2] = r1
			if d1 == d2:
				self.table[r1] -= 1
		else:
			self.table[r1] = r2

	def __str__(self):
		rt = [i if j < 0 else j for (i, j) in enumerate(self.table)]
		return str(rt)
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	n = I()
	ans = [-1]
	for i in range(n // 7 + 1):
		for j in range(n // 5 + 1):
			if (n - 7 * i - 5 * j) % 3 == 0 and n - 7 * i - 5 * j >= 0:
				ans = [(n - 7 * i - 5 * j) // 3, j, i]
	print(*ans)


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)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	c = 1
	for i in range(400):
		for j in range(101):
			t = 3 * i + j * 5
			if (n - t) % 7 == 0 and n - t >= 0:
				c = 0
				print(i, j, (n - t) // 7)
				break
		if c == 0:
			break
	if c == 1:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	flag = False
	for i in range(n // 7 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 3 + 1):
				if i * 7 + j * 5 + k * 3 == n:
					print(k, j, i)
					flag = True
				if flag:
					break
			if flag:
				break
		if flag:
			break
	else:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		a = [3, 5, 7]
		res = [0, 0, 0]
		found = False
		for (idx, i) in enumerate(a):
			if n - 7 > 0 and (n - 7) % i == 0:
				res[idx] = (n - 7) // i
				res[2] += 1
				found = True
				break
			elif n - 5 > 0 and (n - 5) % i == 0:
				res[idx] = (n - 5) // i
				res[1] += 1
				found = True
				break
			elif n - 3 > 0 and (n - 3) % i == 0:
				res[idx] = (n - 3) // i
				res[0] += 1
				found = True
				break
		if not found:
			print(-1)
		else:
			print(*res)


import sys
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
input = sys.stdin.readline
getS = lambda : input().strip()
getN = lambda : int(input())
getList = lambda : list(map(int, input().split()))
getZList = lambda : [int(x) - 1 for x in input().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)

def judge(at, ax, ay, bt, bx, by):
	if abs(at - bt) >= abs(ax - bx) + abs(ay - by):
		return True
	else:
		return False

def solve():
	n = getN()
	for i in range(n // 7 + 2):
		for j in range((n - 7 * i) // 5 + 2):
			for k in range((n - 7 * i - 5 * j) // 3 + 2):
				if i * 7 + j * 5 + k * 3 == n:
					print(k, j, i)
					return
	print(-1)
	return

def main():
	n = getN()
	for _ in range(n):
		solve()
	return
main()


from sys import stdin
input = stdin.readline

def solve():
	n = int(input())
	for a in range(n // 7 + 1):
		for b in range((n - a * 7) // 5 + 1):
			left = n - a * 7 - b * 5
			if left >= 0 and left % 3 == 0:
				print(left // 3, b, a)
				return
	print(-1)
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	n = int(input())
	if n % 3 == 0 or n % 5 == 0 or n % 7 == 0:
		if n % 3 == 0:
			print(n // 3, 0, 0)
		elif n % 5 == 0:
			print(0, n // 5, 0)
		else:
			print(0, 0, n // 7)
	else:
		dictionary = {3: 0, 5: 0, 7: 0}
		l = []
		while 1:
			if n % 3 == 0 or n % 5 == 0 or n % 7 == 0:
				if n % 3 == 0:
					if n > 0:
						print(n // 3 + dictionary[3], 0, 0)
					else:
						print(-1)
				elif n % 5 == 0:
					if n > 0:
						print(dictionary[3], n // 5, 0)
					else:
						print(-1)
				elif n > 0:
					print(dictionary[3], 0, n // 7)
				else:
					print(-1)
				break
			else:
				n = n - 3
				dictionary[3] += 1


for _ in range(int(input())):
	n = int(input())
	flag = False
	for x in range(334):
		for y in range(201):
			if (n - 3 * x - 5 * y) % 7 == 0 and n - 3 * x - 5 * y >= 0:
				print(x, y, (n - 3 * x - 5 * y) // 7)
				flag = True
				break
		if flag:
			break
	if not flag:
		print(-1)


from math import *
import threading
import sys
mod = 10 ** 9 + 7

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li
sys.setrecursionlimit(300000)
for _ in range(int(input()) if True else 1):
	n = int(input())
	rems = [1, 2, 4]
	if n in rems:
		print(-1)
	else:
		quo7 = n // 7 - (n % 7 in rems)
		n -= quo7 * 7
		quo5 = n // 5 - (n % 5 in rems)
		n -= quo5 * 5
		if n % 3 != 0:
			print(-1)
		else:
			print(n // 3, quo5, quo7)


def solve():
	n = int(input())
	(a, b, c) = (-1, -1, -1)
	if n == 1 or n == 2 or n == 4:
		print(-1)
		return
	else:
		if n == 0:
			print(0, 0, 0)
		elif n == 3:
			print(1, 0, 0)
		elif n == 5:
			print(0, 1, 0)
		elif n == 6:
			print(2, 0, 0)
		elif n == 7:
			print(0, 0, 1)
		elif n % 3 == 2:
			print((n - 5) // 3, 1, 0)
		elif n % 3 == 1:
			print((n - 10) // 3, 2, 0)
		elif n % 3 == 0:
			print(n // 3, 0, 0)
		return

def main():
	t = int(input())
	for i in range(t):
		solve()
	return
main()


def f(n):
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return [i, j, k]
	return -1
t = int(input())
for _ in range(t):
	n = int(input())
	x = f(n)
	if x == -1:
		print(-1)
	else:
		print(*x)


t = int(input())
while t:
	t -= 1
	n = int(input())
	flag = False
	for i in range(n // 3 + 2):
		wini = 3 * i
		if wini > n or flag:
			break
		for j in range(n // 5 + 2):
			winj = wini + 5 * j
			if winj > n or flag:
				break
			for k in range(n // 7 + 2):
				wink = winj + 7 * k
				if wink > n or flag:
					break
				if wink == n:
					ans = [i, j, k]
					print(*ans)
					flag = True
					break
	if not flag:
		print(-1)


t = int(input())
for i in range(t):
	n = int(input())
	three = 0
	five = 0
	seven = 0
	if n == 1 or n == 2 or n == 4:
		print('-1')
	else:
		if n % 3 == 0:
			three += n // 3
		elif n % 5 == 0:
			five += n // 5
		elif n % 7 == 0:
			seven += n // 7
		else:
			while n != 1:
				if n % 10 == 1:
					n -= 6
					three += 2
				elif n % 10 == 2:
					n -= 7
					seven += 1
				elif n % 10 == 3:
					n -= 3
					three += 1
				elif n % 10 == 4:
					n -= 14
					seven += 2
				elif n % 10 == 5:
					five += n // 5
					break
				elif n % 10 == 6:
					n -= 6
					three += 2
				elif n % 10 == 7:
					n -= 7
					seven += 1
				elif n % 10 == 8:
					n -= 8
					three += 1
					five += 1
				elif n % 10 == 9:
					n -= 9
					three += 3
				n = n - 5
				five += 1
		print(three, five, seven)


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


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)


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

def num(i, j, k):
	return 3 * i + 5 * j + 7 * k

def count(n):
	for i in range(n // 3 + 1):
		for j in range((n - 3 * i) // 5 + 1):
			for k in range((n - 3 * i - 5 * j) // 7 + 1):
				n2 = num(i, j, k)
				if n2 == n:
					return (i, j, k)
				elif n2 > n:
					break
	return False
for _ in range(readint()):
	n = readint()
	ans = count(n)
	if ans:
		print(join(' ', count(n)))
	else:
		print(-1)
	print('\n')


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)


t = int(input())
for _ in range(t):
	f = False
	n = int(input())
	k = n // 7
	for i in range(k, -1, -1):
		n1 = n - i * 7
		c = 0
		while n1 % 5 > 0 and n1 > 0:
			n1 -= 3
			c += 1
		if n1 % 5 == 0:
			print(c, n1 // 5, i)
			f = True
			break
	if not f:
		print(-1)


import sys
t = int(input().strip())
for a0 in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n % 7 == 0:
		a = n // 7
		print(0, 0, a)
	elif n % 7 == 1:
		a = n // 7
		print(1, 1, a - 1)
	elif n % 7 == 2:
		a = n // 7
		print(3, 0, a - 1)
	elif n % 7 == 3:
		a = n // 7
		print(1, 0, a)
	elif n % 7 == 4:
		a = n // 7
		print(2, 1, a - 1)
	elif n % 7 == 5:
		a = n // 7
		print(0, 1, a)
	elif n % 7 == 6:
		a = n // 7
		print(2, 0, a)


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b, c) = (-1, -1, -1)
	for i in range(n // 3 + 1):
		for j in range((n - i * 3) // 5 + 1):
			for k in range((n - j * 5) // 7 + 1):
				if i * 3 + j * 5 + k * 7 == n:
					a = i
					b = j
					c = k
					break
			if a != -1:
				break
		if a != -1:
			break
	if a == -1:
		print(a)
	else:
		print(a, b, c)


T = int(input())
flag = False
for qwq in range(0, T):
	flag = False
	a = int(input())
	if a % 7 == 0:
		print('0 0 %d\n' % (a / 7))
		flag = True
	else:
		b = a
		lim = int(a / 7) + 1
		for i in range(0, lim):
			if b % 5 == 0:
				print('0 %d %d\n' % (b / 5, i))
				flag = True
				break
			limm = int(b / 5) + 1
			c = b
			for j in range(0, limm):
				if c % 3 == 0:
					print('%d %d %d\n' % (c / 3, j, i))
					flag = True
					break
				c -= 5
			b -= 7
			if flag == True:
				break
	if flag == False:
		print('-1\n')


def solve(n):
	if n < 5:
		if n == 3:
			print(1, 0, 0)
		else:
			print(-1)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 5 == 3:
		print(1, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 4:
		print(0, (n - 14) // 5, 2)
	elif n % 5 == 1:
		print(2, (n - 6) // 5, 0)
	elif n % 5 == 2:
		print(0, (n - 7) // 5, 1)
for _ in range(int(input())):
	n = int(input())
	solve(n)


for i1 in range(int(input())):
	n = int(input())
	if n % 7 == 0:
		print(0, 0, n // 7)
		continue
	if n % 3 == 0:
		print(n // 3, 0, 0)
		continue
	if n % 5 == 0:
		print(0, n // 5, 0)
		continue
	if n < 7:
		print(-1)
		continue
	else:
		if n % 3 == 0:
			print(n // 3, 0, 0)
			continue
		if n % 5 == 0:
			print(0, n // 5, 0)
			continue
		lim = n
		i = 1
		while 3 * i < lim:
			t = n - 3 * i
			if t % 5 == 0:
				break
			i += 1
		print(i, t // 5, 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')


t = int(input())
for i in range(0, t):
	m = int(input())
	ans = []
	if m == 1 or m == 2 or m == 4:
		ans = [-1]
	else:
		x = m % 10
		if x == 1:
			fr = int((m - 11) / 5)
			ans = [2, fr + 1, 0]
		if x == 2:
			fr = int((m - 12) / 5)
			ans = [4, fr, 0]
		if x == 3:
			fr = int((m - 3) / 5)
			ans = [1, fr, 0]
		if x == 4:
			fr = int((m - 14) / 5)
			ans = [0, fr, 2]
		if x == 5:
			fr = int(m / 5)
			ans = [0, fr, 0]
		if x == 6:
			fr = int((m - 6) / 5)
			ans = [2, fr, 0]
		if x == 7:
			fr = int((m - 7) / 5)
			ans = [0, fr, 1]
		if x == 8:
			fr = int(m / 5)
			ans = [1, fr, 0]
		if x == 9:
			fr = int((m - 9) / 5)
			ans = [3, fr, 0]
		if x == 0:
			fr = int(m / 5)
			ans = [0, fr, 0]
	print(*ans, sep=' ')


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])


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = n // 7
	b = n // 5
	ans = ()
	for i in range(a + 1):
		for j in range(b + 1):
			rem = n - i * 7 - j * 5
			if rem >= 0 and (not ans) and (rem % 3 == 0):
				ans = (rem // 3, j, i)
				break
	if ans:
		print(*ans)
	else:
		print(-1)


def print_ans(mp):
	s = ''
	for v in [3, 5, 7]:
		s += str(mp.get(v, 0)) + ' '
	print(s)

def solve():
	n = int(input())
	arr = [3, 5, 7]
	for (i, d) in enumerate(arr):
		s = 0
		while s + d <= n:
			s += d
			if n % s == 0:
				print_ans({d: n // d})
				return
			for j in range(3):
				if j != i and (n - s) % arr[j] == 0:
					print_ans({d: s // d, arr[j]: (n - s) // arr[j]})
					return
	print(-1)
t = int(input())
for _ in range(t):
	solve()


def fun():
	for _ in range(n):
		for __ in range(n):
			if (n - 3 * _ - 5 * __) % 7 == 0 and n - 3 * _ - 5 * __ >= 0:
				return [_, __, (n - 3 * _ - 5 * __) // 7]
	return [-1]
for _ in range(int(input())):
	n = int(input())
	print(*fun())


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)


def main():
	n = int(input())
	svn = n // 7
	left = n % 7
	five = 0
	three = 0
	if left == 6:
		three = 2
	if left == 5:
		five = 1
	if left == 4:
		svn -= 1
		three = 2
		five = 1
	if left == 3:
		three = 1
	if left == 2:
		svn -= 1
		three = 3
	if left == 1:
		svn -= 1
		five = 1
		three = 1
	if svn < 0 or three < 0 or five < 0:
		print(-1)
	else:
		print(three, five, svn)
t = int(input())
for i in range(t):
	main()


import sys
import heapq

class Solution:

	def process(self, total):
		costs = [3, 5, 7]
		res = [0, 0, 0]

		def backtrack(curr, res):
			if curr == total:
				return res[:]
			elif curr > total:
				return None
			for i in range(len(costs) - 1, -1, -1):
				curr += costs[i]
				res[i] += 1
				ans = backtrack(curr, res)
				curr -= costs[i]
				res[i] -= 1
				if ans is not None:
					return ans
			return None
		ans = backtrack(0, res)
		return ans if ans and total > 0 else [-1]

	def parse(self, lines, n):
		for i in range(n):
			print(*self.process(int(lines[i])))

def main():
	lines = sys.stdin.readlines()
	n = int(lines[0])
	for i in range(1, n):
		lines[i] = lines[i].replace('\n', '').strip()
	Solution().parse(lines[1:], n)
main()


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))


def main():
	for _ in range(int(input())):
		n = int(input())
		flag = False
		for i in range(n):
			for j in range(n):
				if (n - i * 3 - j * 5) % 7 == 0 and n - i * 3 - j * 5 >= 0:
					print(i, j, (n - i * 3 - j * 5) // 7)
					flag = True
					break
			if flag:
				break
		if not flag:
			print(-1)
main()


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)


t = int(input())
for x in range(t):
	n = int(input())
	c = 0
	a = []
	while True:
		if n == 1 or n == 2 or n == 4:
			print('-1')
			break
		elif n % 3 == 0:
			a = a + [n // 3, 0, 0]
			break
		elif n % 5 == 0:
			a = a + [0, n // 5, 0]
			break
		elif n % 7 == 0:
			a = a + [0, 0, n // 7]
			break
		else:
			r = n % 7
			if r == 3:
				a = a + [1, 0, n // 7]
				break
			elif r == 6:
				a = a + [2, 0, n // 7]
				break
			elif r == 5:
				a = a + [0, 1, n // 7]
				break
			else:
				r = n % 5
				if r == 3:
					a = a + [1, n // 5, 0]
					break
				elif (n - 5) % 3 == 0:
					a = a + [n // 3 - 1, 1, 0]
					break
				elif (n - 7) % 3 == 0:
					a = a + [n // 3 - 2, 0, 1]
					break
	if c == 0:
		for x in a:
			print(x, end=' ')
		print()


import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

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

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
t = I()
for _ in range(t):
	n = I()
	ans = 0
	ok = False
	for i in range(n // 7 + 1):
		for j in range((n - i * 7) // 2 + 1):
			if (n - i * 7 - j * 5) % 3 or n - i * 7 - j * 5 < 0:
				continue
			print((n - i * 7 - j * 5) // 3, j, i)
			ok = True
			break
		if ok:
			break
	if not ok:
		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


t = int(input())
for _ in range(t):
	n = int(input())
	ok = False
	for i in range(1001):
		if ok:
			break
		if i * 3 > n:
			break
		for j in range(1001 - i * 3):
			if ok:
				break
			if i * 3 + j * 5 > n:
				break
			for k in range(1001 - i * 3 - j * 5):
				if i * 3 + j * 5 + k * 7 == n:
					print(i, j, k)
					ok = True
					break
				if i * 3 + j * 5 + k * 7 > n:
					break
	if not ok:
		print(-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)


def do():
	q = int(input())
	for _ in range(q):
		n = int(input())
		can = False
		for i in range(1000):
			newn = n - 7 * i
			if newn < 0:
				break
			for j in range(1000):
				newn2 = newn - 5 * j
				if newn2 < 0:
					break
				if newn2 % 3 == 0:
					k = newn2 // 3
					print(k, j, i)
					can = True
				if can:
					break
			if can:
				break
		if can is False:
			print(-1)
do()


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())
for f in range(t):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		flag = False
		for i in range(0, n, 5):
			for j in range(0, n, 7):
				if (n - i - j) % 3 == 0:
					flag = True
					print((n - i - j) // 3, i // 5, j // 7)
					break
			if flag:
				break
		if not flag:
			print(-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)


for t in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	elif n == 3:
		print(1, 0, 0)
	elif n == 5:
		print(0, 1, 0)
	elif n == 6:
		print(2, 0, 0)
	elif n == 7:
		print(0, 0, 1)
	elif n == 8:
		print(1, 1, 0)
	elif n == 9:
		print(3, 0, 0)
	else:
		k_5 = (3 - n % 3) % 3
		print((n - k_5 * 5) // 3, k_5, 0)


def check(ch, mas):
	if ch - 7 >= 0:
		res = check(ch - 7, [mas[0], mas[1], mas[2] + 1])
		if res[0] != -1:
			return res
	if ch - 5 >= 0:
		res = check(ch - 5, [mas[0], mas[1] + 1, mas[2]])
		if res[0] != -1:
			return res
	if ch - 3 >= 0:
		res = check(ch - 3, [mas[0] + 1, mas[1], mas[2]])
		if res[0] != -1:
			return res
	if ch == 0:
		return mas
	return [-1]
for i in range(int(input())):
	ch = int(input())
	print(*check(ch, [0, 0, 0]))


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)


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	ans = []
	for i in range(n):
		for j in range(n):
			for k in range(n):
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					return
	print(-1)
	return
for _ in range(iinp()):
	solve()


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 solve():
	n = int(input().strip())
	(three, five, seven) = (1 + n // 3, 1 + n // 5, 1 + n // 7)
	for i in range(three):
		for j in range(five):
			for k in range(seven):
				if n == 3 * i + 5 * j + 7 * k:
					print(i, j, k)
					return
	print(-1)
for _ in range(int(input().strip())):
	solve()


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 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

def count(n):
	if n % 3 == 0:
		return (n // 3, 0, 0)
	if n % 5 == 0:
		return (0, n // 5, 0)
	if n % 7 == 0:
		return (0, 0, n // 7)
	if n < 7:
		return False
	c = count(n - 3)
	if c:
		return (c[0] + 1, c[1] + 0, c[2] + 0)
	c = count(n - 5)
	if c:
		return (c[0] + 0, c[1] + 1, c[2] + 0)
	c = count(n - 7)
	if c:
		return (c[0] + 0, c[1] + 0, c[2] + 1)
	return False
for _ in range(readint()):
	n = readint()
	c = count(n)
	if c:
		print(join(' ', c))
	else:
		print(-1)
	print('\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])


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math

def geti():
	return map(int, input().strip().split())

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

def gets():
	return input()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

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


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)


T = int(input())
while T > 0:
	n = int(input())
	mo = n % 10
	(x, y, z) = (0, 0, 0)
	form = False
	if mo == 0:
		form = True
		y = n // 5
	elif mo == 1:
		if n >= 11:
			form = True
			(x, y) = (2, (n - 6) // 5)
	elif mo == 2:
		if n >= 12:
			form = True
			(x, y) = (4, (n - 12) // 5)
	elif mo == 3:
		form = True
		(x, y) = (1, (n - 3) // 5)
	elif mo == 4:
		if n >= 14:
			form = True
			(y, z) = ((n - 14) // 5, 2)
	elif mo == 5:
		form = True
		y = n // 5
	elif mo == 6:
		form = True
		(x, y) = (2, (n - 6) // 5)
	elif mo == 7:
		form = True
		(y, z) = ((n - 7) // 5, 1)
	elif mo == 8:
		form = True
		(x, y) = (1, (n - 3) // 5)
	else:
		form = True
		(x, y) = (3, (n - 9) // 5)
	if form is False:
		print(-1)
	else:
		print(str(x) + ' ' + str(y) + ' ' + str(z))
	T -= 1


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())


def f(a, b, c):
	return str(a) + ' ' + str(b) + ' ' + str(c)
ans = []
for _ in range(int(input())):
	n = int(input())
	c = n // 7
	r = n % 7
	a = b = 0
	if r == 0:
		ans.append(f(a, b, c))
	elif r == 3:
		a += 1
		ans.append(f(a, b, c))
	elif r == 5:
		b += 1
		ans.append(f(a, b, c))
	elif r == 6:
		a += 2
		ans.append(f(a, b, c))
	elif c == 0:
		ans.append(str(-1))
	elif r == 1:
		c -= 1
		a += 1
		b += 1
		ans.append(f(a, b, c))
	elif r == 2:
		c -= 1
		a += 3
		ans.append(f(a, b, c))
	else:
		c -= 1
		a += 2
		b += 1
		ans.append(f(a, b, c))
print('\n'.join(ans))


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right
from itertools import permutations

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

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
ans = [0, 0, [1, 0, 0], 0, [0, 1, 0], [2, 0, 0], [0, 0, 1], [1, 1, 0], [3, 0, 0], [0, 2, 0], [2, 1, 0], [4, 0, 0], [1, 2, 0], [0, 0, 2], [5, 0, 0], [2, 2, 0], [0, 2, 1], [2, 1, 1], [0, 1, 2]]
for i in range(20, 1001):
	x = ans[i - 6]
	req = i - (3 * x[0] + 5 * x[1] + 7 * x[2])
	y = ans[req - 1]
	z = [x[0] + y[0], x[1] + y[1], x[2] + y[2]]
	ans.append(z)
for i in range(INT()):
	n = INT()
	if ans[n - 1] == 0:
		print(-1)
	else:
		print(*ans[n - 1])


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 _ in range(t):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
		continue
	if n % 5 == 0:
		print(0, n // 5, 0)
		continue
	if n % 7 == 0:
		print(0, 0, n // 7)
		continue
	if n == 4 or n == 1 or n == 2:
		print(-1)
		continue
	elif n % 3 != 0:
		s = 0
		while n % 5 != 0 and n % 7 != 0:
			s = s + 1
			n = n - 3
			if n % 5 == 0:
				print(s, n // 5, 0)
				break
			if n % 7 == 0:
				print(s, 0, n // 7)
				break
		continue


import math
t = int(input())
while t:
	t -= 1
	y = [int(i) for i in input().split()]
	n = y[0]
	f = 0
	for i in range(n):
		if f:
			break
		for j in range(n):
			k = n - i * 3 - j * 5
			if k >= 0 and (not k % 7):
				print(i, j, k // 7)
				f = 1
				break
	if not f:
		print(-1)


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)


t = int(input())
for i in range(t):
	n = int(input())
	x = n % 7
	if x == 3:
		print(x // 3, '0', n // 7)
	elif x == 5:
		print('0', x // 5, n // 7)
	elif x == 0:
		print('0', '0', n // 7)
	elif x == 1:
		if n - 7 > 0:
			print(x, x, (n - 7) // 7)
		else:
			print('-1')
	elif x == 2:
		if n - 7 > 0:
			print(x + 1, '0', (n - 7) // 7)
		else:
			print('-1')
	elif x == 4:
		if n - 7 > 0:
			print('2', '1', (n - 7) // 7)
		else:
			print('-1')
	elif x == 6:
		print('2', '0', n // 7)


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)


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 % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif n % 15 == 0:
		print(n // 15, n // 15, n // 15)
	else:
		rem = n % 3
		a = n // 3
		if rem == 1:
			print(a - 2, 0, 1)
		if rem == 2:
			print(a - 1, 1, 0)


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		test = 0
		a3 = 0
		while n > 3:
			n -= 3
			a3 += 1
			if n % 5 == 0:
				test = 1
				a5 = n // 5
				print(a3, a5, 0)
				break
			elif n % 7 == 0:
				test = 1
				a7 = n // 7
				print(a3, 0, a7)
				break
		if not test:
			print(-1)


n = int(input())
for i in range(0, n):
	o = int(input())
	l = [0, 0, 0]
	G = 0
	while o > 0:
		if o % 3 == 0:
			G = 1
			l[0] += o // 3
			break
		elif o % 5 == 0:
			l[1] += o // 5
			G = 1
			break
		elif o % 7 == 0:
			l[2] += o // 7
			G = 1
			break
		else:
			o -= 3
			l[0] += 1
	if G == 0:
		print(-1)
	else:
		print(l[0], l[1], l[2])


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)


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

def intt():
	return int(input())
t = intt()
for i in range(t):
	n = intt()
	flag = 0
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if n - i * 3 - j * 5 - k * 7 == 0:
					print(str(i) + ' ' + str(j) + ' ' + str(k))
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 0:
		print(-1)


for _ in range(int(input())):
	n = int(input())
	bool = False
	for i in range(n // 7 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 3 + 1):
				if i * 7 + j * 5 + k * 3 == n:
					bool = True
					print(k, j, i)
					break
				if bool:
					break
			if bool:
				break
		if bool:
			break
	if not bool:
		print(-1)


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


from sys import stdin
for _ in range(int(stdin.readline())):
	t = int(stdin.readline())
	x = 0
	y = 0
	z = 0
	mod = t % 7
	if mod == 0:
		pass
	elif mod == 1:
		x += 1
		y += 1
	elif mod == 2:
		x += 3
	elif mod == 3:
		x += 1
	elif mod == 4:
		x += 2
		y += 1
	elif mod == 5:
		y += 1
	elif mod == 6:
		x += 2
	total = 3 * x + 5 * y
	if total > t:
		print(-1)
		continue
	else:
		z = (t - total) // 7
		print(x, y, z)


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])))


t = int(input())
for _ in range(t):
	n = int(input())
	flag = 0
	for i in range(n):
		for j in range(n):
			if flag:
				break
			if 3 * i + 5 * j > n:
				break
			left = n - 3 * i - 5 * j
			if left % 7 == 0:
				print('{} {} {}'.format(i, j, left // 7))
				flag = 1
				break
	if flag == 0:
		print('-1')


t = int(input())
for tc in range(t):
	n = int(input())
	save = n
	flag = 0
	(c3, c5, c7) = (0, 0, 0)
	if n < 3:
		print('-1')
		continue
	if n % 3 == 0:
		c3 = n // 3
		print(c3, c5, c7)
		flag = 1
	elif n % 7 == 0:
		c7 = n // 7
		print(c3, c5, c7)
		flag = 1
	elif n % 5 == 0:
		c5 = n // 5
		print(c3, c5, c7)
		flag = 1
	if flag == 0:
		(c3, c5, c7) = (0, 0, 0)
		n = save - 3
		c3 = 1
		flag = 0
		if n < 3:
			print('-1')
			continue
		if n % 3 == 0:
			c3 = n // 3
			print(c3, c5, c7)
			flag = 1
		elif n % 7 == 0:
			c7 = n // 7
			print(c3, c5, c7)
			flag = 1
		elif n % 5 == 0:
			c5 = n // 5
			print(c3, c5, c7)
			flag = 1
	if flag == 0:
		(c3, c5, c7) = (0, 0, 0)
		n = save - 5
		c5 = 1
		flag = 0
		if n < 3:
			print('-1')
			continue
		if n % 3 == 0:
			c3 = n // 3
			print(c3, c5, c7)
			continue
			flag = 1
		elif n % 7 == 0:
			c7 = n // 7
			print(c3, c5, c7)
			continue
			flag = 1
		elif n % 5 == 0:
			c5 = n // 5
			print(c3, c5, c7)
			continue
			flag = 1
	if flag == 0:
		(c3, c5, c7) = (0, 0, 0)
		n = save - 7
		c7 = 1
		flag = 0
		if n < 3:
			print('-1')
			continue
		if n % 3 == 0:
			c3 = n // 3
			print(c3, c5, c7)
			continue
			flag = 1
		elif n % 7 == 0:
			c7 = n // 7
			print(c3, c5, c7)
			continue
			flag = 1
		elif n % 5 == 0:
			c5 = n // 5
			print(c3, c5, c7)
			continue
			flag = 1
	if flag == 0:
		print('-1')


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)


def solve(n):
	for i in range(n // 3 + 1):
		for j in range((n - i * 3) // 5 + 1):
			for k in range((n - i * 3 - j * 5) // 7 + 1):
				if i * 3 + j * 5 + k * 7 == n:
					return (i, j, k)
	return [-1]
for _ in range(int(input())):
	n = int(input())
	print(*solve(n))


import collections
for t in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
		continue
	if n % 5 == 0:
		print(0, n // 5, 0)
		continue
	if n % 7 == 0:
		print(0, 0, n // 7)
		continue
	if n == 8:
		print(1, 1, 0)
		continue
	if n < 10:
		print(-1)
		continue
	mod = n % 10
	if mod == 1:
		n -= 11
		print(2, 1 + n // 5, 0)
	if mod == 2:
		n -= 12
		print(4, n // 5, 0)
	if mod == 3:
		n -= 3
		print(1, n // 5, 0)
	if mod == 4:
		n -= 14
		print(0, n // 5, 2)
	if mod == 6:
		n -= 6
		print(2, n // 5, 0)
	if mod == 7:
		n -= 7
		print(0, n // 5, 1)
	if mod == 8:
		n -= 8
		print(1, 1 + n // 5, 0)
	if mod == 9:
		n -= 9
		print(3, n // 5, 0)


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)


import math
test = int(input())
for _ in range(test):
	n = int(input())
	flag = 0
	for i in range(n):
		for j in range(n):
			x = n - (3 * i + 5 * j)
			if x % 7 == 0 and x // 7 >= 0:
				print(i, j, x // 7)
				flag = 1
				break
		if flag == 1:
			break
	if flag == 0:
		print(-1)


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


t = int(input())
if t <= 1000:
	for i in range(t):
		n = int(input())
		if n > 1000:
			print('-1')
			continue
		found = 0
		x = 0
		y = 0
		z = 0
		for a in range(int(n / 3) + 1):
			x = y = z = 0
			x = a + 1
			if x * 3 == n:
				found = 1
				break
			for b in range(int(n / 5) + 1):
				y = z = 0
				y = b + 1
				if x * 3 + y * 5 == n:
					found = 1
					break
				if y * 5 == n:
					found = 1
					x = z = 0
					break
				for c in range(int(n / 7) + 1):
					z = c + 1
					if x * 3 + y * 5 + z * 7 == n:
						found = 1
						break
					if z * 7 == n:
						found = 1
						x = y = 0
						break
				else:
					continue
				break
			else:
				continue
			break
		if found == 1:
			print(str(x) + ' ' + str(y) + ' ' + str(z))
		else:
			print('-1')


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	ans = False
	for i in range(6):
		if n - 3 * i >= 0 and (n - 3 * i) % 5 == 0:
			print(i, (n - 3 * i) // 5, 0)
			ans = True
			break
		if n - 7 * i >= 0 and (n - 7 * i) % 5 == 0:
			print(0, (n - 7 * i) // 5, i)
			ans = True
			break
	if not ans:
		print(-1)


n = int(input())
x5 = 0
x7 = 0
x3 = 0
for i in range(n):
	nabor = int(input())
	if nabor == 1 or nabor == 2 or nabor == 4:
		print(-1)
	elif nabor % 5 == 0:
		x5 = nabor // 5
		print(0, x5, 0)
	elif nabor % 7 == 0:
		x7 = nabor // 7
		print(0, 0, x7)
	else:
		ostatok = nabor % 3
		if ostatok == 0:
			x3 = nabor // 3
			print(x3, 0, 0)
		else:
			while True:
				ostatok += 3
				if ostatok % 7 == 0 or ostatok % 5 == 0:
					break
			if ostatok % 7 == 0:
				x7 = ostatok // 7
				x3 = (nabor - x7 * 7) // 3
				x5 = 0
			else:
				x5 = ostatok // 5
				x3 = (nabor - x5 * 5) // 3
				x7 = 0
			print(x3, x5, x7)


def solve(N):
	for i in range(0, 1000 // 7 + 1):
		for j in range(0, 201):
			if i * 7 + j * 5 > N:
				break
			if (N - (i * 7 + j * 5)) % 3 == 0:
				arr = [(N - (i * 7 + j * 5)) // 3, j, i]
				return ' '.join(map(str, arr))
	return -1
T = int(input())
for t in range(T):
	N = int(input())
	ans = solve(N)
	print(ans)


def tran(n):
	non = [1, 2, 4]
	if n % 3 == 0:
		return [int(n / 3), 0, 0]
	elif n % 5 == 0:
		return [0, int(n / 5), 0]
	elif n % 7 == 0:
		return [0, 0, int(n / 7)]
	elif n in non:
		return -1
	elif (n - 5) % 3 == 0:
		return [int((n - 5) / 3), 1, 0]
	elif (n - 7) % 3 == 0:
		return [int((n - 7) / 3), 0, 1]
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	r = tran(n)
	ans.append(r)
for i in ans:
	if i != -1:
		print(*i)
	else:
		print(i)


def solve(n):
	for i in range(142):
		for j in range(201):
			k = n - 7 * i - 5 * j
			if k < 0:
				continue
			if k % 3 == 0:
				return (k // 3, j, i)
	return [-1]
for _ in range(int(input())):
	n = int(input())
	print(*solve(n))


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()


for __ in range(int(input())):
	n = int(input())
	(a1, a2, a3) = (0, 0, 0)
	for i in range(n // 3 + 1):
		if a1 != 0 or a2 != 0 or a3 != 0:
			break
		for j in range(n // 5 + 1):
			if (n - 3 * i - 5 * j) % 7 == 0 and (n - 3 * i - 5 * j) // 7 >= 0:
				(a1, a2, a3) = (i, j, (n - 3 * i - 5 * j) // 7)
				break
	if a1 == a2 == a3:
		print(-1)
	else:
		print(a1, a2, a3)


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)


global x
x = input()
x = int(x)
while x > 0:
	n = input()
	n = int(n)
	k = n / 3
	k = int(k)
	n %= 3
	if n == 0:
		print(k, ' ', 0, ' ', 0)
	elif n == 1:
		if k >= 2:
			k -= 2
			print(k, ' ', 0, ' ', 1)
		else:
			print(-1)
	elif k > 0:
		k -= 1
		print(k, ' ', 1, ' ', 0)
	else:
		print(-1)
	x -= 1


def readis():
	return map(int, input().strip().split())
T = int(input())
while T:
	T -= 1
	n = int(input())
	d = {0: (0, 0, 0), 1: None, 2: None, 3: (1, 0, 0), 4: None, 5: (0, 1, 0), 6: (2, 0, 0), 7: (0, 0, 1), 8: (1, 1, 0), 9: (3, 0, 0)}
	if n < 10 and d[n] is None:
		print(-1)
	else:
		(x, y, z) = (0, 0, 0)
		m = n % 10
		if d[m] is None:
			if m == 1:
				(x, y, z) = (2, 1, 0)
				n -= 11
			elif m == 2:
				(x, y, z) = (0, 1, 1)
				n -= 12
			elif m == 4:
				(x, y, z) = (0, 0, 2)
				n -= 14
			m = 0
		(_x, _y, _z) = d[m]
		print(x + _x + n // 10, y + _y, z + _z + n // 10)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print(-1)
	elif n % 3 == 0:
		print(n // 3, end=' ')
		print(0, end=' ')
		print(0)
	elif n % 5 == 0:
		print(0, end=' ')
		print(n // 5, end=' ')
		print(0)
	elif n % 7 == 0:
		print(0, end=' ')
		print(0, end=' ')
		print(n // 7)
	else:
		c = 0
		for i in range(0, n // 7 + 1):
			f = 0
			x = n - 7 * i
			if x % 3 == 0:
				print(x // 3, end=' ')
				print(0, end=' ')
				print(i)
				c = 1
				break
			elif x % 5 == 0:
				print(0, end=' ')
				print(x // 5, end=' ')
				print(i)
				c = 1
				break
			else:
				for j in range(1, x // 5 + 1):
					y = x - 5 * j
					if y % 3 == 0:
						c = 1
						print(y // 3, end=' ')
						print(j, end=' ')
						print(i)
						f = 1
						break
			if f == 1:
				break
		if c == 0:
			print(-1)


from sys import stdin
n = int(stdin.readline())
for _ in range(n):
	num = int(stdin.readline())
	if num in (1, 2, 4):
		print(-1)
		continue
	if num == 3:
		print(1, 0, 0)
		continue
	elif num == 5:
		print(0, 1, 0)
		continue
	elif num == 6:
		print(2, 0, 0)
		continue
	count = 0
	while num >= 14:
		count += 1
		num -= 7
	if num == 7:
		print(0, 0, count + 1)
	elif num == 8:
		print(1, 1, count)
	elif num == 9:
		print(3, 0, count)
	elif num == 10:
		print(0, 2, count)
	elif num == 11:
		print(2, 1, count)
	elif num == 12:
		print(4, 0, count)
	elif num == 13:
		print(1, 2, count)


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)


def read_int() -> int:
	return int(input())

def div_range(n, div):
	return range(n // div + 1)

def test_case():
	n = read_int()
	print(next((f'{x} {y} {z}' for x in div_range(n, 3) for y in div_range(n, 5) for z in div_range(n, 7) if 3 * x + 5 * y + 7 * z == n), -1))
for _ in range(read_int()):
	test_case()


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	c = 0
	f = 0
	for a in range(201):
		for b in range(150):
			if n - a * 5 - b * 7 >= 0 and (n - a * 5 - b * 7) % 3 == 0:
				print((n - a * 5 - b * 7) // 3, a, b)
				f = 1
				break
		if f:
			break
	if f == 0:
		print(-1)


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])


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(n // 7 + 1):
		for j in range((n - 7 * i) // 5 + 1):
			rest = n - 7 * i - 5 * j
			if rest >= 0 and rest % 3 == 0:
				print('{} {} {}'.format(rest // 3, j, i))
				break
		else:
			continue
		break
	else:
		print(-1)


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


for _ in range(int(input())):
	n = int(input())
	(f1, f2) = (False, False)
	f3 = True
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					f1 = True
					break
			if f1:
				f2 = True
				break
		if f2:
			f3 = False
			break
	if f3:
		print(-1)


import sys
from sys import stdin, stdout

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

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

def solve():
	n = II()
	xx = 1000 // 3 + 4
	yy = 1000 // 5 + 4
	zz = 1000 // 7 + 4
	for i in range(xx):
		for j in range(yy):
			rem = n - (3 * i + 5 * j)
			if rem >= 0 and rem % 7 == 0:
				print(i, j, rem // 7)
				return
	print(-1)
	return
t = II()
for i in range(t):
	solve()


T = int(input())
for i in range(T):
	N = int(input())
	(Sum, Answers) = (0, [])
	for j in range(N):
		for k in range(N):
			Sum = N - 3 * j - 5 * k
			if Sum < 0:
				break
			if Sum % 7 == 0:
				Answers = [j, k, Sum // 7]
				break
		if len(Answers) == 3:
			break
	if len(Answers) == 3:
		print(Answers[0], Answers[1], Answers[2])
	else:
		print(-1)


try:
	m = int(input())
	lst = []
	for j in range(m):
		ele = int(input())
		lst.append(ele)
	for i in range(m):
		n = lst[i]
		ys_count = 0
		c = 0
		d = 0
		for i in range(0, n + 1, 1):
			for j in range(0, n + 1, 1):
				for k in range(0, n + 1, 1):
					if i * 3 + j * 5 + k * 7 == n:
						print(i, j, k)
						ys_count = ys_count + 1
						c = 1
						d = 1
						break
				if c == 1:
					break
			if d == 1:
				break
		if ys_count == 0:
			print('-1')
except:
	pass


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)


t = int(input())
for _ in range(t):
	n = int(input())
	if n <= 7:
		if n == 3:
			print(1, 0, 0)
			continue
		if n == 6:
			print(2, 0, 0)
			continue
		if n == 5:
			print(0, 1, 0)
			continue
		if n == 7:
			print(0, 0, 1)
			continue
		print(-1)
	else:
		if n % 7 == 0:
			print(0, 0, n // 7)
			continue
		rem = n % 7
		if n == 9:
			print(3, 0, 0)
			continue
		if n == 11:
			print(2, 1, 0)
			continue
		if rem == 1:
			print(1, 1, n // 7 - 1)
			continue
		if rem == 2 and n >= 16:
			print(2, 2, n // 7 - 2)
			continue
		if rem == 3:
			print(1, 0, n // 7)
			continue
		if rem == 4 and n >= 18:
			print(1, 3, n // 7 - 2)
			continue
		if rem == 5:
			print(0, 1, n // 7)
			continue
		if rem == 6:
			print(2, 0, n // 7)
			continue
		print(-1)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	mat = [[0, 0, 0], [2, 1, 0], [4, 0, 0], [1, 0, 0], [0, 0, 2], [0, 1, 0], [2, 0, 0], [0, 0, 1], [1, 1, 0], [3, 0, 0]]
	digit = n % 10
	ans = mat[digit]
	val = 3 * ans[0] + 5 * ans[1] + 7 * ans[2]
	extra = n - val
	ans[1] += int(extra / 5)
	if ans[1] < 0:
		print(-1)
		return
	print(*ans)
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	s = int(input())
	m = s - 3
	n = s - 5
	p = s - 7
	if s % 3 == 0:
		print(int(s / 3), '0', '0')
	elif s % 5 == 0:
		print('0', int(s / 5), '0')
	elif s % 7 == 0:
		print('0', '0', int(s / 7))
	elif m % 5 == 0 and m > 0:
		print('1', int(m / 5), '0')
	elif m % 7 == 0 and m > 0:
		print('1', '0', int(m / 7))
	elif n % 3 == 0 and n > 0:
		print(int(n / 3), '1', '0')
	elif n % 7 == 0 and n > 0:
		print('0', '1', int(n / 7))
	elif p % 3 == 0 and p > 0:
		print(int(p / 3), '0', '1')
	elif p % 5 == 0 and p > 0:
		print('0', int(p / 5), '1')
	else:
		print('-1')


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)


for _ in range(int(input())):
	n = int(input())
	s = 0
	f = 0
	t = 0
	while True:
		if n % 7 == 0:
			s = n // 7
			n = 0
			break
		elif n % 5 == 0:
			f = n // 5
			n = 0
			break
		n -= 3
		t += 1
		if n <= 0:
			break
	if n != 0:
		print(-1)
	else:
		print(t, f, s)


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)


n = int(input())
numbers = []
for i in range(n):
	numbers.append(int(input()))
for i in range(len(numbers)):
	if numbers[i] % 7 == 0:
		numbers[i] = [0, 0, numbers[i] // 7]
		continue
	elif numbers[i] % 5 == 0:
		numbers[i] = [0, numbers[i] // 5, 0]
		continue
	elif numbers[i] % 3 == 0:
		numbers[i] = [numbers[i] // 3, 0, 0]
		continue
	elif not numbers[i] in [0, 1, 2, 4]:
		for j in range(1, numbers[i] // 3 + 1):
			num = numbers[i]
			num = num - int(3 * j)
			if num > 1:
				if num % 5 == 0:
					numbers[i] = [j, num // 5, 0]
					break
				elif num % 7 == 0:
					numbers[i] = [j, 0, num // 7]
					break
	else:
		numbers[i] = -1
		continue
for i in numbers:
	if i == -1:
		print(i)
	else:
		print(i[0], i[1], i[2])


for _ in range(int(input())):
	n = int(input())
	ans = []
	found = False
	for x in range(150):
		for y in range(205):
			sm = 7 * x + 5 * y
			if sm > n:
				break
			if (n - sm) % 3 == 0:
				found = True
				ans = [(n - sm) // 3, y, x]
				break
		if found:
			break
	if found:
		print(*ans)
	else:
		print('-1')


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		c7 = 0
		c3 = 0
		c5 = 0
		c7 = n // 7
		if c7 == 0:
			if n == 3:
				print(1, 0, 0)
			elif n == 5:
				print(0, 1, 0)
			elif n == 6:
				print(2, 0, 0)
		else:
			n = n % 7
			if n == 0:
				print(0, 0, c7)
			elif n == 1:
				print(1, 1, c7 - 1)
			elif n == 2:
				print(3, 0, c7 - 1)
			elif n == 3:
				print(1, 0, c7)
			elif n == 4:
				print(2, 1, c7 - 1)
			elif n == 5:
				print(0, 1, c7)
			elif n == 6:
				print(2, 0, c7)


t = int(input())
for _ in range(t):
	n = int(input())
	r = int(pow(n, 0.5))
	l = []
	flage = False
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if i * 3 + j * 5 + k * 7 == n:
					l = [i, j, k]
					flage = True
					break
			if flage:
				break
		if flage:
			break
	if flage:
		print(*l)
	else:
		print(-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)


def solve():
	n = int(input())
	p = True
	(i, k) = (0, 0)
	ans = '-1'
	while i <= n:
		k = 0
		while k <= n and p:
			if (n - i - k) % 7 == 0:
				ans = '{0} {1} {2}'.format(i // 3, k // 5, (n - i - k) // 7)
				p = False
			k += 5
		i += 3
	print(ans)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	N = int(input())
	if N <= 5:
		if N == 1 or N == 2 or N == 4:
			print(-1)
		elif N == 3:
			print(1, 0, 0)
		else:
			print(0, 1, 0)
	elif N == 7:
		print(0, 0, 1)
	elif N % 3 == 0:
		print(N // 3, 0, 0)
	elif N % 5 == 0:
		print(0, N // 5, 0)
	elif N % 5 == 1:
		print(2, (N - 6) // 5, 0)
	elif N % 5 == 2:
		print(4, (N - 12) // 5, 0)
	elif N % 5 == 3:
		print(1, (N - 3) // 5, 0)
	elif N % 5 == 4:
		print(3, (N - 9) // 5, 0)


def apartment(n):
	for m in range(int(n / 7) + 1):
		for k in range(int(n / 5) + 1):
			if (n - (m * 7 + k * 5)) % 3 == 0 and n - (m * 7 + k * 5) >= 0:
				return (int((n - (m * 7 + k * 5)) / 3), k, m)
	return (-1, -1, -1)
for test_var in range(int(input())):
	num = int(input())
	ans = apartment(num)
	if ans[0] == -1:
		print(-1)
	else:
		print(ans[0], ans[1], ans[2])


def window(n):
	for x in range(n // 3 + 1):
		for y in range(n // 5 + 1):
			for z in range(n // 7 + 1):
				if x * 3 + y * 5 + z * 7 == n:
					return str(x) + ' ' + str(y) + ' ' + str(z)
	return '-1'
for i in range(int(input())):
	n = int(input())
	print(window(n))


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()


for _ in range(int(input())):
	n = int(input())
	out = False
	for i in range(143):
		for j in range(201):
			for k in range(334):
				if i * 7 + j * 5 + k * 3 == n:
					out = True
					break
				if i * 7 + j * 5 + k * 3 > n:
					break
			if out:
				break
			if i * 7 + j * 5 > n:
				break
		if out:
			break
		if i * 7 > n:
			break
	if out:
		print(k, j, i)
	else:
		print(-1)


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=' ')


n = int(input())
res = [[0, 0, 0]] * n
for i in range(n):
	a = int(input())
	b = a % 10
	if b == 0:
		c = a // 5
		res[i] = [0, c, 0]
	elif b == 1:
		a = a - 3 - 3 - 5
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (2, c + 1, 0)
	elif b == 1:
		a = a - 3 - 3 - 5
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (2, c + 1, 0)
	elif b == 2:
		a = a - 3 * 4
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (4, c, 0)
	elif b == 3:
		a = a - 3
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (1, c, 0)
	elif b == 4:
		a = a - 7 - 7
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (0, c, 2)
	elif b == 5:
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (0, c, 0)
	elif b == 6:
		a = a - 3 - 3
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (2, c, 0)
	elif b == 7:
		a = a - 7
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (0, c, 1)
	elif b == 8:
		a = a - 3 - 5
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (1, c + 1, 0)
	elif b == 9:
		a = a - 3 - 3 - 3
		c = a // 5
		if a < 0:
			res[i] = -1
		else:
			res[i] = (3, c, 0)
for i in range(n):
	if res[i] == -1:
		print(-1)
	else:
		print(res[i][0], res[i][1], res[i][2])


for i in range(int(input())):
	n = int(input())
	f = 1
	for ix in range(0, 1001):
		temp = n
		x = ix
		temp -= 3 * x
		if temp >= 0:
			for iy in range(0, 1001):
				temp2 = temp
				y = iy
				temp2 -= 5 * iy
				if temp2 >= 0:
					for iz in range(0, 1001):
						temp3 = temp2
						z = iz
						temp3 -= 7 * z
						if temp3 == 0:
							f = 0
							print(x, y, z)
							break
						elif temp3 < 0:
							break
				else:
					break
				if f == 0:
					break
		else:
			break
		if f == 0:
			break
	if f == 1:
		print(-1)


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)


t = int(input())
for i in range(t):
	n = int(input())
	three = 0
	five = 0
	seven = 0
	if n % 5 == 1:
		seven = 0
		three = 2
		five = (n - 6) // 5
	if n % 5 == 2:
		seven = 1
		three = 0
		five = (n - 7) // 5
	if n % 5 == 3:
		three = 1
		five = (n - 3) // 5
		seven = 0
	if n % 5 == 4:
		seven = 0
		three = 3
		five = (n - 9) // 5
	if n % 5 == 0:
		three = 0
		five = n // 5
		seven = 0
	if n == three * 3 + five * 5 + seven * 7 and three >= 0 and (five >= 0) and (seven >= 0):
		print(str(three) + ' ' + str(five) + ' ' + str(seven))
	else:
		print(-1)


from sys import stdin
_input = stdin.readline
(_int, _range) = (int, range)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		f = False
		for i in _range(0, n + 1, 3):
			for j in _range(i, n + 1, 5):
				if (n - i - (j - i)) % 7 == 0:
					print(i // 3, (j - i) // 5, (n - i - (j - i)) // 7)
					f = True
					break
			if f:
				break
		if not f:
			print(-1)
solution()


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)


t = int(input())
out = []
for _ in range(t):
	n = int(input())
	found = False
	for i in range(n // 7 + 1):
		braked = False
		for j in range(n // 5 + 1):
			u = n - i * 7 - j * 5
			if u >= 0 and u % 3 == 0:
				out.append(f'{u // 3} {j} {i}')
				braked = True
				break
		if braked:
			found = True
			break
	if not found:
		out.append('-1')
print('\n'.join(out))


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)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	possible = False
	for i in range(1000):
		for j in range(1000):
			a = 5 * i + 7 * j
			if a > n:
				break
			if (n - a) % 3 == 0:
				print((n - a) // 3, i, j)
				possible = True
				break
		if possible == True:
			break
	if possible == False:
		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=' ')


t = int(input())

def compute(n):
	for x in range(0, n // 3 + 5):
		for y in range(0, n // 5 + 5):
			for j in range(0, n // 7 + 5):
				if 3 * x + 5 * y + 7 * j == n:
					print('%s %s %s' % (x, y, j))
					return
	print('-1')
	return
for _ in range(t):
	n = int(input())
	compute(n)


import sys
input = sys.stdin.readline

def solveA(n):
	if n in [1, 2, 4]:
		return (-1,)
	for i in range(1 + n // 3):
		for j in range(1 + n // 5):
			for k in range(1 + n // 7):
				if 3 * i + 5 * j > n:
					break
				if 3 * i + 5 * j + 7 * k == n:
					return (i, j, k)
			if 3 * i + 5 * j > n:
				break
t = int(input())
for _ in range(t):
	n = int(input())
	print(*solveA(n))


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)


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())

def print_list(l):
	print(' '.join(map(str, l)))
for _ in range(N()):
	n = N()
	for a in range(n // 3 + 1):
		flag = False
		for b in range((n - a * 3) // 5 + 1):
			if (n - a * 3 - b * 5) % 7 == 0:
				print(a, b, (n - a * 3 - b * 5) // 7)
				flag = True
				break
		if flag:
			break
	if not flag:
		print(-1)


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)


t = int(input())

def solution(a, b, n):
	i = 0
	while i * a <= n:
		if (n - i * a) % b == 0:
			return (i, int((n - i * a) / b))
		i = i + 1
	return -1
while t:
	n = int(input())
	candidates = [3, 5, 7]
	flag = False
	for i in range(n // 3 + 1):
		target = n - 3 * i
		res = solution(5, 7, target)
		if res != -1:
			flag = True
			print(i, res[0], res[1])
			break
	if not flag:
		print(-1)
	t -= 1


def per(n):
	for x in range(n):
		for y in range(n):
			for z in range(n):
				if 3 * x + 5 * y + 7 * z == n:
					return (x, y, z)
	return -1
t = int(input())
res = ''
for i in range(t):
	n = int(input())
	res = per(n)
	if res == -1:
		print(-1)
	else:
		print(*res)


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
r = sys.stdin.readline
for _ in range(int(r())):
	n = int(r())
	flg = False
	for i in range(n // 3 + 1):
		if flg:
			break
		for j in range((n - 3 * i) // 5 + 1):
			if flg:
				break
			for k in range((n - 3 * i - 5 * j) // 7 + 1):
				if flg:
					break
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					flg = True
	if not flg:
		print(-1)


t = int(input())
while t:
	n = int(input())
	d = {1: [2, -1, 0], 2: [3, 0, -1], 3: [1, 0, 0], 4: [2, 1, -1], 5: [0, 1, 0], 6: [2, 0, 0], 7: [0, 0, 1], 8: [1, 1, 0], 9: [3, 0, 0], 10: [1, 0, 1], 11: [2, 1, 0], 12: [0, 1, 1], 13: [1, 2, 0], 14: [0, 0, 2], 0: [0, 0, 0]}
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		k = n % 15
		s = n // 15
		r = d[k]
		for i in range(3):
			r[i] += s
		print(*r)
	t -= 1


t = int(input())
for i in range(t):
	x3 = 0
	x5 = 0
	x7 = 0
	n = int(input())
	while n > 0:
		if n % 3 == 0:
			x3 += n // 3
			n = 0
		elif n % 5 == 0:
			x5 += n // 5
			n = 0
		elif n % 7 == 0:
			x7 += n // 7
			n = 0
		else:
			n -= 3
			x3 += 1
	if n < 0:
		print(-1)
	else:
		print(x3, x5, x7)


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)


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	l = [0, 0, 0]
	r = n % 7
	if r == 1:
		if r + 7 <= n:
			print(1, 1, n // 7 - 1)
		else:
			print(-1)
	elif r == 2:
		if r + 7 <= n:
			print(3, 0, n // 7 - 1)
		else:
			print(-1)
	elif r == 3:
		print(1, 0, n // 7)
	elif r == 4:
		if r + 7 <= n:
			print(2, 1, n // 7 - 1)
		else:
			print(-1)
	elif r == 5:
		print(0, 1, n // 7)
	elif r == 6:
		print(2, 0, n // 7)
	elif r == 0:
		print(0, 0, n // 7)


for _ in range(int(input())):
	n = int(input())
	d = [1, 2, 4]
	if n in d:
		print(-1)
		continue
	temp = n % 10
	if temp == 1:
		print(2, (n - 6) // 5, 0)
	elif temp == 2:
		print(4, (n - 12) // 5, 0)
	elif temp == 3:
		print(1, (n - 3) // 5, 0)
	elif temp == 4:
		print(0, (n - 14) // 5, 2)
	elif temp == 5 or temp == 0:
		print(0, n // 5, 0)
	elif temp == 6:
		print(2, (n - 6) // 5, 0)
	elif temp == 7:
		print(0, (n - 7) // 5, 1)
	elif temp == 8:
		print(1, 1 + (n - 8) // 5, 0)
	elif temp == 9:
		print(3, (n - 9) // 5, 0)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi
import math
from itertools import permutations
from copy import deepcopy

def main():
	for t in range(int(input())):
		n = int(input())
		(a, b, c) = (0, 0, 0)
		for i in range(n + 1):
			f = 0
			for j in range(n + 1):
				if n - 3 * i - 5 * j >= 0:
					if (n - 3 * i - 5 * j) % 7 == 0:
						f = 1
						a = i
						b = j
						c = (n - 3 * i - 5 * j) // 7
						break
				else:
					break
			if f:
				break
		if a == 0 and b == 0 and (c == 0):
			print(-1)
		else:
			print(a, b, c)
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()


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)


from sys import stdin, stdout
import math, bisect
from collections import Counter, deque, defaultdict
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()

def pr(a):
	return ' '.join(list(map(str, a)))

def solve():
	n = I()
	(a, b, c) = (0, 0, 0)
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif 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)
for _ in range(I()):
	solve()


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


for _ in range(int(input())):
	n = int(input())
	l = [3, 5, 7]
	c = 0
	for z in range(3):
		if n % l[z] == 0:
			ans = [int(n / l[z]) if x == z else 0 for x in range(3)]
			print(*ans)
			c = 1
			break
	if c == 0:
		for z in range(3):
			if c == 1:
				break
			if n > l[z]:
				v = n - l[z]
				k = 0
				while k < 3:
					if k != z:
						if v % l[k] == 0:
							ans = []
							for x in range(3):
								if x == z:
									ans.append(1)
								elif x == k:
									ans.append(int(v / l[k]))
								else:
									ans.append(0)
							c = 1
							print(*ans)
							break
					k += 1
	if c == 0:
		print(-1)


global arr
global p

def precalc():
	global arr, p
	T = 1000
	p = [0 for _ in range(T + 1)]
	p[0] = 1
	arr = [[0, 0, 0] for _ in range(T + 1)]
	rooms = [3, 5, 7]
	for i in range(1, T + 1):
		for room in rooms:
			if i - room >= 0 and p[i - room]:
				(three, five, seven) = arr[i - room]
				if room == 3:
					arr[i] = [three + 1, five, seven]
				elif room == 5:
					arr[i] = [three, five + 1, seven]
				else:
					arr[i] = [three, five, seven + 1]
				p[i] = 1

def main():
	global arr, p
	n = int(input())
	if not p[n]:
		print(-1)
		return
	else:
		print('{} {} {}'.format(arr[n][0], arr[n][1], arr[n][2]))
precalc()
for _ in range(int(input())):
	main()


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 f(n):
	for i in range(0, n // 5 + 1):
		for j in range(0, n // 7 + 1):
			x = n - 5 * i - 7 * j
			if x >= 0 and x % 3 == 0:
				return [x // 3, i, j]
	return [-1]
t = int(input())
for i in range(0, t):
	n = int(input())
	M = f(n)
	print(*M)


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 eq(x, y, z):
	return 3 * x + 5 * y + 7 * z
t = int(input())
n = 1
for i in range(t):
	g = 0
	x = 0
	y = 0
	z = 0
	if eq(x, y, z) == n:
		break
	n = int(input())
	for x in range(0, n // 3 + 1):
		if g == 1:
			break
		for y in range(0, n // 5 + 1):
			if g == 1:
				break
			for z in range(0, n // 7 + 1):
				if g == 1:
					break
				if eq(x, y, z) == n:
					print(x, y, z)
					g += 1
	if g == 0:
		print(-1)


def number_of_apartments(num):
	if num in [1, 2, 4]:
		return -1
	elif num == 5:
		return [0, 1, 0]
	elif num == 7:
		return [0, 0, 1]
	else:
		(three, five, seven) = (0, 0, 0)
		while num != 0:
			if num % 3 == 0:
				three += num // 3
				return [three, five, seven]
			elif num % 5 == 0:
				five += num // 5
				return [three, five, seven]
			elif num % 7 == 0:
				seven += num // 7
				return [three, five, seven]
			else:
				num -= 3
				three += 1
		else:
			return [three, five, seven]
for x in range(int(input())):
	a = number_of_apartments(int(input()))
	if a == -1:
		print(a)
	else:
		print(' '.join([str(x) for x in a]))


for t in range(int(input())):
	n = int(input())
	three = n // 3
	five = n // 5
	seven = n // 7
	flag = 0
	for i in range(three + 1):
		for j in range(five + 1):
			for k in range(seven + 1):
				if 3 * i + 5 * j + 7 * k == n:
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 1:
		print(i, j, k)
	else:
		print(-1)


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


n = int(input())

def sovle():
	k = int(input())
	for z in range(k // 7 + 1):
		for y in range(k // 5 + 1):
			for x in range(k // 3 + 1):
				if x * 3 + y * 5 + z * 7 == k:
					return (x, y, z)
	return (-1, -1, -1)
for _ in range(n):
	(x, y, z) = sovle()
	print(x, y, z) if x > -1 else print(-1)


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 case_n in range(t):
	n = int(input())
	if n < 7:
		if n % 3 == 0:
			a_3 = n // 3
			a_7 = 0
			a_5 = 0
			res = True
		elif n % 5 == 0:
			a_5 = 1
			a_3 = 0
			a_7 = 0
			res = True
		else:
			res = False
	else:
		yp7 = n % 7
		res = True
		if yp7 == 0:
			a_3 = 0
			a_5 = 0
			a_7 = n // 7
		elif yp7 == 1:
			a_3 = 1
			a_5 = 1
			a_7 = n // 7 - 1
		elif yp7 == 2:
			a_3 = 3
			a_7 = n // 7 - 1
			a_5 = 0
		elif yp7 == 3:
			a_5 = 0
			a_3 = 1
			a_7 = n // 7
		elif yp7 == 4:
			a_7 = n // 7 - 2
			a_3 = 1
			a_5 = 3
			if n == 11:
				a_5 = 1
				a_3 = 2
				a_7 = 0
		elif yp7 == 5:
			a_5 = 1
			a_3 = 0
			a_7 = n // 7
		elif yp7 == 6:
			a_5 = 0
			a_3 = 2
			a_7 = n // 7
	if res:
		print('{0} {1} {2}'.format(a_3, a_5, a_7))
	else:
		print('-1')


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')


t = int(input())
while t != 0:
	n = int(input())
	p = n // 10
	(f, s, th) = (0, 0, 0)
	f += 2 * p
	n = n % 10
	if n == 1:
		f -= 2
		th += 2
		f += 1
	elif n == 2:
		f -= 1
		s += 1
	elif n == 3:
		th += 1
	elif n == 4:
		f -= 1
		th += 3
	elif n == 5:
		f += 1
	elif n == 6:
		th += 2
	elif n == 7:
		s += 1
	elif n == 8:
		f += 1
		th += 1
	elif n == 9:
		th += 3
	if f >= 0 and s >= 0 and (th >= 0):
		print(th, f, s)
	else:
		print(-1)
	t -= 1


ans = ['0 0 0', '-1', '-1', '1 0 0', '-1', '0 1 0', '2 0 0', '0 0 1', '1 1 0', '3 0 0', '0 2 0', '2 1 0', '4 0 0', '1 2 0', '0 0 2', '5 0 0', '2 2 0', '1 0 2', '6 0 0', '3 2 0', '0 4 0', '7 0 0', '4 2 0', '1 4 0', '8 0 0', '0 5 0', '2 4 0', '9 0 0', '0 0 4', '3 4 0', '10 0 0', '1 0 4', '4 4 0', '11 0 0', '2 0 4', '0 7 0', '12 0 0', '3 0 4', '1 7 0', '13 0 0', '0 8 0', '2 7 0', '14 0 0', '1 8 0', '3 7 0', '15 0 0', '2 8 0', '4 7 0', '16 0 0', '0 0 7', '0 10 0', '17 0 0', '1 0 7', '1 10 0', '18 0 0', '0 11 0', '0 0 8', '19 0 0', '1 11 0', '1 0 8', '20 0 0', '2 11 0', '2 0 8', '21 0 0', '3 11 0', '0 13 0', '22 0 0', '4 11 0', '1 13 0', '23 0 0', '0 14 0', '2 13 0', '24 0 0', '1 14 0', '3 13 0', '25 0 0', '2 14 0', '0 0 11', '26 0 0', '3 14 0', '0 16 0', '27 0 0', '4 14 0', '1 16 0', '28 0 0', '0 17 0', '2 16 0', '29 0 0', '1 17 0', '3 16 0', '30 0 0', '0 0 13', '4 16 0', '31 0 0', '1 0 13', '0 19 0', '32 0 0', '2 0 13', '0 0 14', '33 0 0', '0 20 0', '1 0 14', '34 0 0', '1 20 0', '2 0 14', '35 0 0', '2 20 0', '3 0 14', '36 0 0', '3 20 0', '0 22 0', '37 0 0', '0 0 16', '1 22 0', '38 0 0', '0 23 0', '2 22 0', '39 0 0', '1 23 0', '0 0 17', '40 0 0', '2 23 0', '1 0 17', '41 0 0', '3 23 0', '0 25 0', '42 0 0', '4 23 0', '1 25 0', '43 0 0', '0 26 0', '2 25 0', '44 0 0', '0 0 19', '3 25 0', '45 0 0', '1 0 19', '4 25 0', '46 0 0', '2 0 19', '0 28 0', '47 0 0', '3 0 19', '1 28 0', '48 0 0', '0 29 0', '2 28 0', '49 0 0', '1 29 0', '3 28 0', '50 0 0', '2 29 0', '4 28 0', '51 0 0', '0 0 22', '0 31 0', '52 0 0', '1 0 22', '1 31 0', '53 0 0', '0 32 0', '0 0 23', '54 0 0', '1 32 0', '1 0 23', '55 0 0', '2 32 0', '2 0 23', '56 0 0', '3 32 0', '0 34 0', '57 0 0', '4 32 0', '1 34 0', '58 0 0', '0 35 0', '2 34 0', '59 0 0', '1 35 0', '3 34 0', '60 0 0', '2 35 0', '0 0 26', '61 0 0', '3 35 0', '0 37 0', '62 0 0', '4 35 0', '1 37 0', '63 0 0', '0 38 0', '2 37 0', '64 0 0', '1 38 0', '3 37 0', '65 0 0', '0 0 28', '4 37 0', '66 0 0', '1 0 28', '0 40 0', '67 0 0', '2 0 28', '0 0 29', '68 0 0', '0 41 0', '1 0 29', '69 0 0', '1 41 0', '2 0 29', '70 0 0', '2 41 0', '3 0 29', '71 0 0', '3 41 0', '0 43 0', '72 0 0', '0 0 31', '1 43 0', '73 0 0', '0 44 0', '2 43 0', '74 0 0', '1 44 0', '0 0 32', '75 0 0', '2 44 0', '1 0 32', '76 0 0', '3 44 0', '0 46 0', '77 0 0', '4 44 0', '1 46 0', '78 0 0', '0 47 0', '2 46 0', '79 0 0', '0 0 34', '3 46 0', '80 0 0', '1 0 34', '4 46 0', '81 0 0', '2 0 34', '0 49 0', '82 0 0', '3 0 34', '1 49 0', '83 0 0', '0 50 0', '2 49 0', '84 0 0', '1 50 0', '3 49 0', '85 0 0', '2 50 0', '4 49 0', '86 0 0', '0 0 37', '0 52 0', '87 0 0', '1 0 37', '1 52 0', '88 0 0', '0 53 0', '0 0 38', '89 0 0', '1 53 0', '1 0 38', '90 0 0', '2 53 0', '2 0 38', '91 0 0', '3 53 0', '0 55 0', '92 0 0', '4 53 0', '1 55 0', '93 0 0', '0 56 0', '2 55 0', '94 0 0', '1 56 0', '3 55 0', '95 0 0', '2 56 0', '0 0 41', '96 0 0', '3 56 0', '0 58 0', '97 0 0', '4 56 0', '1 58 0', '98 0 0', '0 59 0', '2 58 0', '99 0 0', '1 59 0', '3 58 0', '100 0 0', '0 0 43', '4 58 0', '101 0 0', '1 0 43', '0 61 0', '102 0 0', '2 0 43', '0 0 44', '103 0 0', '0 62 0', '1 0 44', '104 0 0', '1 62 0', '2 0 44', '105 0 0', '2 62 0', '3 0 44', '106 0 0', '3 62 0', '0 64 0', '107 0 0', '0 0 46', '1 64 0', '108 0 0', '0 65 0', '2 64 0', '109 0 0', '1 65 0', '0 0 47', '110 0 0', '2 65 0', '1 0 47', '111 0 0', '3 65 0', '0 67 0', '112 0 0', '4 65 0', '1 67 0', '113 0 0', '0 68 0', '2 67 0', '114 0 0', '0 0 49', '3 67 0', '115 0 0', '1 0 49', '4 67 0', '116 0 0', '2 0 49', '0 70 0', '117 0 0', '3 0 49', '1 70 0', '118 0 0', '0 71 0', '2 70 0', '119 0 0', '1 71 0', '3 70 0', '120 0 0', '2 71 0', '4 70 0', '121 0 0', '0 0 52', '0 73 0', '122 0 0', '1 0 52', '1 73 0', '123 0 0', '0 74 0', '0 0 53', '124 0 0', '1 74 0', '1 0 53', '125 0 0', '2 74 0', '2 0 53', '126 0 0', '3 74 0', '0 76 0', '127 0 0', '4 74 0', '1 76 0', '128 0 0', '0 77 0', '2 76 0', '129 0 0', '1 77 0', '3 76 0', '130 0 0', '2 77 0', '0 0 56', '131 0 0', '3 77 0', '0 79 0', '132 0 0', '4 77 0', '1 79 0', '133 0 0', '0 80 0', '2 79 0', '134 0 0', '1 80 0', '3 79 0', '135 0 0', '0 0 58', '4 79 0', '136 0 0', '1 0 58', '0 82 0', '137 0 0', '2 0 58', '0 0 59', '138 0 0', '0 83 0', '1 0 59', '139 0 0', '1 83 0', '2 0 59', '140 0 0', '2 83 0', '3 0 59', '141 0 0', '3 83 0', '0 85 0', '142 0 0', '0 0 61', '1 85 0', '143 0 0', '0 86 0', '2 85 0', '144 0 0', '1 86 0', '0 0 62', '145 0 0', '2 86 0', '1 0 62', '146 0 0', '3 86 0', '0 88 0', '147 0 0', '4 86 0', '1 88 0', '148 0 0', '0 89 0', '2 88 0', '149 0 0', '0 0 64', '3 88 0', '150 0 0', '1 0 64', '4 88 0', '151 0 0', '2 0 64', '0 91 0', '152 0 0', '3 0 64', '1 91 0', '153 0 0', '0 92 0', '2 91 0', '154 0 0', '1 92 0', '3 91 0', '155 0 0', '2 92 0', '4 91 0', '156 0 0', '0 0 67', '0 94 0', '157 0 0', '1 0 67', '1 94 0', '158 0 0', '0 95 0', '0 0 68', '159 0 0', '1 95 0', '1 0 68', '160 0 0', '2 95 0', '2 0 68', '161 0 0', '3 95 0', '0 97 0', '162 0 0', '4 95 0', '1 97 0', '163 0 0', '0 98 0', '2 97 0', '164 0 0', '1 98 0', '3 97 0', '165 0 0', '2 98 0', '0 0 71', '166 0 0', '3 98 0', '0 100 0', '167 0 0', '4 98 0', '1 100 0', '168 0 0', '0 101 0', '2 100 0', '169 0 0', '1 101 0', '3 100 0', '170 0 0', '0 0 73', '4 100 0', '171 0 0', '1 0 73', '0 103 0', '172 0 0', '2 0 73', '0 0 74', '173 0 0', '0 104 0', '1 0 74', '174 0 0', '1 104 0', '2 0 74', '175 0 0', '2 104 0', '3 0 74', '176 0 0', '3 104 0', '0 106 0', '177 0 0', '0 0 76', '1 106 0', '178 0 0', '0 107 0', '2 106 0', '179 0 0', '1 107 0', '0 0 77', '180 0 0', '2 107 0', '1 0 77', '181 0 0', '3 107 0', '0 109 0', '182 0 0', '4 107 0', '1 109 0', '183 0 0', '0 110 0', '2 109 0', '184 0 0', '0 0 79', '3 109 0', '185 0 0', '1 0 79', '4 109 0', '186 0 0', '2 0 79', '0 112 0', '187 0 0', '3 0 79', '1 112 0', '188 0 0', '0 113 0', '2 112 0', '189 0 0', '1 113 0', '3 112 0', '190 0 0', '2 113 0', '4 112 0', '191 0 0', '0 0 82', '0 115 0', '192 0 0', '1 0 82', '1 115 0', '193 0 0', '0 116 0', '0 0 83', '194 0 0', '1 116 0', '1 0 83', '195 0 0', '2 116 0', '2 0 83', '196 0 0', '3 116 0', '0 118 0', '197 0 0', '4 116 0', '1 118 0', '198 0 0', '0 119 0', '2 118 0', '199 0 0', '1 119 0', '3 118 0', '200 0 0', '2 119 0', '0 0 86', '201 0 0', '3 119 0', '0 121 0', '202 0 0', '4 119 0', '1 121 0', '203 0 0', '0 122 0', '2 121 0', '204 0 0', '1 122 0', '3 121 0', '205 0 0', '0 0 88', '4 121 0', '206 0 0', '1 0 88', '0 124 0', '207 0 0', '2 0 88', '0 0 89', '208 0 0', '0 125 0', '1 0 89', '209 0 0', '1 125 0', '2 0 89', '210 0 0', '2 125 0', '3 0 89', '211 0 0', '3 125 0', '0 127 0', '212 0 0', '0 0 91', '1 127 0', '213 0 0', '0 128 0', '2 127 0', '214 0 0', '1 128 0', '0 0 92', '215 0 0', '2 128 0', '1 0 92', '216 0 0', '3 128 0', '0 130 0', '217 0 0', '4 128 0', '1 130 0', '218 0 0', '0 131 0', '2 130 0', '219 0 0', '0 0 94', '3 130 0', '220 0 0', '1 0 94', '4 130 0', '221 0 0', '2 0 94', '0 133 0', '222 0 0', '3 0 94', '1 133 0', '223 0 0', '0 134 0', '2 133 0', '224 0 0', '1 134 0', '3 133 0', '225 0 0', '2 134 0', '4 133 0', '226 0 0', '0 0 97', '0 136 0', '227 0 0', '1 0 97', '1 136 0', '228 0 0', '0 137 0', '0 0 98', '229 0 0', '1 137 0', '1 0 98', '230 0 0', '2 137 0', '2 0 98', '231 0 0', '3 137 0', '0 139 0', '232 0 0', '4 137 0', '1 139 0', '233 0 0', '0 140 0', '2 139 0', '234 0 0', '1 140 0', '3 139 0', '235 0 0', '2 140 0', '0 0 101', '236 0 0', '3 140 0', '0 142 0', '237 0 0', '4 140 0', '1 142 0', '238 0 0', '0 143 0', '2 142 0', '239 0 0', '1 143 0', '3 142 0', '240 0 0', '0 0 103', '4 142 0', '241 0 0', '1 0 103', '0 145 0', '242 0 0', '2 0 103', '0 0 104', '243 0 0', '0 146 0', '1 0 104', '244 0 0', '1 146 0', '2 0 104', '245 0 0', '2 146 0', '3 0 104', '246 0 0', '3 146 0', '0 148 0', '247 0 0', '0 0 106', '1 148 0', '248 0 0', '0 149 0', '2 148 0', '249 0 0', '1 149 0', '0 0 107', '250 0 0', '2 149 0', '1 0 107', '251 0 0', '3 149 0', '0 151 0', '252 0 0', '4 149 0', '1 151 0', '253 0 0', '0 152 0', '2 151 0', '254 0 0', '0 0 109', '3 151 0', '255 0 0', '1 0 109', '4 151 0', '256 0 0', '2 0 109', '0 154 0', '257 0 0', '3 0 109', '1 154 0', '258 0 0', '0 155 0', '2 154 0', '259 0 0', '1 155 0', '3 154 0', '260 0 0', '2 155 0', '4 154 0', '261 0 0', '0 0 112', '0 157 0', '262 0 0', '1 0 112', '1 157 0', '263 0 0', '0 158 0', '0 0 113', '264 0 0', '1 158 0', '1 0 113', '265 0 0', '2 158 0', '2 0 113', '266 0 0', '3 158 0', '0 160 0', '267 0 0', '4 158 0', '1 160 0', '268 0 0', '0 161 0', '2 160 0', '269 0 0', '1 161 0', '3 160 0', '270 0 0', '2 161 0', '0 0 116', '271 0 0', '3 161 0', '0 163 0', '272 0 0', '4 161 0', '1 163 0', '273 0 0', '0 164 0', '2 163 0', '274 0 0', '1 164 0', '3 163 0', '275 0 0', '0 0 118', '4 163 0', '276 0 0', '1 0 118', '0 166 0', '277 0 0', '2 0 118', '0 0 119', '278 0 0', '0 167 0', '1 0 119', '279 0 0', '1 167 0', '2 0 119', '280 0 0', '2 167 0', '3 0 119', '281 0 0', '3 167 0', '0 169 0', '282 0 0', '0 0 121', '1 169 0', '283 0 0', '0 170 0', '2 169 0', '284 0 0', '1 170 0', '0 0 122', '285 0 0', '2 170 0', '1 0 122', '286 0 0', '3 170 0', '0 172 0', '287 0 0', '4 170 0', '1 172 0', '288 0 0', '0 173 0', '2 172 0', '289 0 0', '0 0 124', '3 172 0', '290 0 0', '1 0 124', '4 172 0', '291 0 0', '2 0 124', '0 175 0', '292 0 0', '3 0 124', '1 175 0', '293 0 0', '0 176 0', '2 175 0', '294 0 0', '1 176 0', '3 175 0', '295 0 0', '2 176 0', '4 175 0', '296 0 0', '0 0 127', '0 178 0', '297 0 0', '1 0 127', '1 178 0', '298 0 0', '0 179 0', '0 0 128', '299 0 0', '1 179 0', '1 0 128', '300 0 0', '2 179 0', '2 0 128', '301 0 0', '3 179 0', '0 181 0', '302 0 0', '4 179 0', '1 181 0', '303 0 0', '0 182 0', '2 181 0', '304 0 0', '1 182 0', '3 181 0', '305 0 0', '2 182 0', '0 0 131', '306 0 0', '3 182 0', '0 184 0', '307 0 0', '4 182 0', '1 184 0', '308 0 0', '0 185 0', '2 184 0', '309 0 0', '1 185 0', '3 184 0', '310 0 0', '0 0 133', '4 184 0', '311 0 0', '1 0 133', '0 187 0', '312 0 0', '2 0 133', '0 0 134', '313 0 0', '0 188 0', '1 0 134', '314 0 0', '1 188 0', '2 0 134', '315 0 0', '2 188 0', '3 0 134', '316 0 0', '3 188 0', '0 190 0', '317 0 0', '0 0 136', '1 190 0', '318 0 0', '0 191 0', '2 190 0', '319 0 0', '1 191 0', '0 0 137', '320 0 0', '2 191 0', '1 0 137', '321 0 0', '3 191 0', '0 193 0', '322 0 0', '4 191 0', '1 193 0', '323 0 0', '0 194 0', '2 193 0', '324 0 0', '0 0 139', '3 193 0', '325 0 0', '1 0 139', '4 193 0', '326 0 0', '2 0 139', '0 196 0', '327 0 0', '3 0 139', '1 196 0', '328 0 0', '0 197 0', '2 196 0', '329 0 0', '1 197 0', '3 196 0', '330 0 0', '2 197 0', '4 196 0', '331 0 0', '0 0 142', '0 199 0', '332 0 0', '1 0 142', '1 199 0', '333 0 0', '0 200 0']
for _ in range(int(input())):
	print(ans[int(input())])


import sys
input = lambda : sys.stdin.readline().rstrip()
from collections import deque
from queue import LifoQueue

def binary_search(a, n):
	L = 0
	R = len(a) - 1
	while L <= R:
		mid = L + (R - L) // 2
		if a[mid] == n:
			return mid
		elif a[mid] < n:
			L = mid + 1
		else:
			R = mid - 1
	return -1
for _ in range(int(input())):
	n = int(input())
	fl = True
	for i in range(n // 7 + 2):
		for j in range(n // 5 + 2):
			if (n - i * 7 - j * 5) % 3 == 0 and n - i * 7 - j * 5 >= 0:
				print((n - i * 7 - j * 5) // 3, j, i)
				fl = False
				break
		if not fl:
			break
	if fl:
		print(-1)


_ = int(input())

def solve(x):
	for i in range(x // 3 + 1):
		for j in range(x // 5 + 1):
			for k in range(x // 7 + 1):
				if i * 3 + j * 5 + k * 7 == x:
					return (i, j, k)
	return (-1, -1, -1)

def main():
	for __ in range(_):
		x = int(input())
		(i, j, k) = solve(x)
		if i == -1:
			print(-1)
		else:
			print(i, j, k)
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.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()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	for i in range(0, n + 1, 3):
		for j in range(0, n + 1, 5):
			for k in range(0, n + 1, 7):
				if i + j + k == n:
					print(i // 3, j // 5, k // 7)
					return
	print(-1)
testcase(int(inp()))


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	if n <= 2 or n == 4:
		print(-1)
		continue
	if n % 3 == 0:
		ans = n // 3
		print(str(ans) + ' 0 ' + '0')
		continue
	elif n % 5 == 0:
		ans = n // 5
		print('0 ' + str(ans) + ' 0')
		continue
	elif n % 7 == 0:
		ans = n // 7
		print('0 0 ' + str(ans))
		continue
	elif n % 8 == 0:
		ans = n // 8
		print(str(ans) + ' ' + str(ans) + ' 0')
		continue
	no3 = n // 3
	remd = n % 3
	no5 = 0
	no7 = 0
	if remd == 1 and no3 >= 2:
		no3 -= 2
		no7 += 1
		print(str(no3) + ' ' + str(no5) + ' ' + str(no7))
		continue
	if remd == 2 and no3 >= 1:
		no3 -= 1
		no5 += 1
		print(str(no3) + ' ' + str(no5) + ' ' + str(no7))
		continue
	print('-1')
	continue


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)


t = int(input())
while t:
	t -= 1
	n = int(input())
	(i, j, k) = (0, 0, 0)
	ok = False
	while i <= n // 7 and (not ok):
		j = 0
		while j <= (n - i * 7) // 5 and (not ok):
			k = 0
			while k <= (n - i * 7 - j * 5) // 3 and (not ok):
				number = n - 7 * i - 5 * j - 3 * k
				if number % 7 == 0:
					i += number // 7
					ok = True
					break
				if number % 5 == 0:
					j += number // 5
					ok = True
					break
				if number % 3 == 0:
					k += number // 3
					ok = True
					break
				guess = 7 * i + 5 * j + 3 * k
				if guess == n:
					ok = True
					break
				k += 1
			if ok:
				break
			j += 1
		if ok:
			break
		i += 1
	if ok:
		print(str(k) + ' ' + str(j) + ' ' + str(i))
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	b = 0
	for i in range(0, 350):
		for j in range(0, 205):
			if n - (3 * i + 5 * j) >= 0 and (n - (3 * i + 5 * j)) % 7 == 0:
				b = 1
				p = i
				q = j
				r = (n - (3 * i + 5 * j)) // 7
				break
		if b:
			break
	if b:
		print(p, q, r)
	else:
		print(-1)


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)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

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


from sys import stdin

def rooms(n: int) -> None:
	for n_3 in range(n // 3 + 1):
		for n_5 in range((n - n_3) // 5 + 1):
			for n_7 in range((n - n_3 - n_5) // 7 + 1):
				if n_3 * 3 + n_5 * 5 + n_7 * 7 == n:
					print(f'{n_3} {n_5} {n_7}')
					return
	print(-1)
t = int(stdin.readline())
cases = (int(stdin.readline()) for _ in range(t))
for n in cases:
	rooms(n)


a = []
for i in range(1000):
	a.append([-1])
a[2] = [1, 0, 0]
a[4] = [0, 1, 0]
a[6] = [0, 0, 1]
for i in range(993):
	if a[i] != [-1]:
		a[i + 3] = [a[i][0] + 1] + a[i][1:]
		a[i + 5] = [a[i][0]] + [a[i][1] + 1] + [a[i][2]]
		a[i + 7] = a[i][:2] + [a[i][2] + 1]
for i in range(995):
	if a[i] != [-1]:
		a[i + 3] = [a[i][0] + 1] + a[i][1:]
		a[i + 5] = [a[i][0]] + [a[i][1] + 1] + [a[i][2]]
for i in range(997):
	if a[i] != [-1]:
		a[i + 3] = [a[i][0] + 1] + a[i][1:]
for i in range(int(input())):
	print(' '.join(list(map(str, a[int(input()) - 1]))))


T = int(input())
for t in range(T):
	N = int(input())
	nb = N % 7
	if nb == 0:
		print(0, 0, N // 7)
	elif nb == 1:
		N -= 8
		if N < 0:
			print(-1)
		else:
			print(1, 1, N // 7)
	elif nb == 2:
		N -= 9
		if N < 0:
			print(-1)
		else:
			print(3, 0, N // 7)
	elif nb == 3:
		N -= 3
		print(1, 0, N // 7)
	elif nb == 4:
		N -= 11
		if N < 0:
			print(-1)
		else:
			print(2, 1, N // 7)
	elif nb == 5:
		N -= 5
		print(0, 1, N // 7)
	elif nb == 6:
		N -= 6
		print(2, 0, N // 7)


for _ in range(int(input())):
	n = int(input())
	d = {1: [-1], 2: [-1], 3: [1, 0, 0], 4: [-1], 5: [0, 1, 0], 6: [2, 0, 0], 7: [0, 0, 1], 8: [1, 1, 0], 9: [3, 0, 0]}
	if n < 10:
		print(*d[n])
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		(a, b, c) = (0, 0, 0)
		if n % 10 == 1:
			n -= 11
			a += 2
			b += 1
			b += n // 5
		elif n % 10 == 2:
			n -= 12
			a += 4
			b += n // 5
		elif n % 10 == 3:
			a += 1
			b += n // 5
		elif n % 10 == 4:
			n -= 14
			c += 2
			b += n // 5
		elif n % 10 == 6:
			a += 2
			n -= 6
			b += n // 5
		elif n % 10 == 7:
			c += 1
			n -= 7
			b += n // 5
		elif n % 10 == 8:
			a += 1
			n -= 3
			b += n // 5
		else:
			n -= 9
			a += 3
			b += n // 5
		print(a, b, c)


def xx(n):
	if n % 3 == 0:
		print(n // 3, 0, 0)
		return
	if n % 5 == 0:
		print(0, n // 5, 0)
		return
	if n % 7 == 0:
		print(0, 0, n // 7)
		return
	if n in [1, 2, 4]:
		print(-1)
		return
	if True:
		for i in range(0, 1 + n // 3):
			for j in range(0, 1 + n // 5):
				for k in range(0, 1 + n // 7):
					if 3 * i + 5 * j + 7 * k == n:
						print(i, j, k)
						return
	print(-1)
	return
for _ in range(int(input())):
	n = int(input())
	xx(n)


a = {512, 8, 521, 11, 524, 527, 17, 533, 23, 536, 26, 29, 542, 32, 548, 38, 551, 41, 554, 44, 557, 47, 563, 53, 566, 569, 59, 572, 62, 578, 68, 71, 584, 74, 587, 593, 83, 596, 86, 599, 89, 92, 608, 611, 101, 614, 104, 617, 107, 113, 626, 116, 629, 632, 122, 638, 128, 641, 131, 134, 647, 137, 653, 143, 656, 146, 659, 149, 662, 152, 668, 158, 671, 674, 164, 677, 167, 683, 173, 176, 689, 179, 692, 698, 188, 701, 191, 704, 194, 197, 713, 716, 206, 719, 209, 722, 212, 218, 731, 221, 734, 737, 227, 743, 233, 746, 236, 239, 752, 242, 758, 248, 761, 251, 764, 254, 767, 257, 773, 263, 776, 779, 269, 782, 272, 788, 278, 281, 794, 284, 797, 803, 293, 806, 296, 809, 299, 302, 818, 821, 311, 824, 314, 827, 317, 323, 836, 326, 839, 842, 332, 848, 338, 851, 341, 344, 857, 347, 863, 353, 866, 356, 869, 359, 872, 362, 878, 368, 881, 884, 374, 887, 377, 893, 383, 386, 899, 389, 902, 908, 398, 911, 401, 914, 404, 407, 923, 926, 416, 929, 419, 932, 422, 428, 941, 431, 944, 947, 437, 953, 443, 956, 446, 449, 962, 452, 968, 458, 971, 461, 974, 464, 977, 467, 983, 473, 986, 989, 479, 992, 482, 998, 488, 491, 494, 503, 506, 509}
b = {514, 517, 523, 13, 526, 16, 529, 19, 22, 538, 541, 31, 544, 34, 547, 37, 43, 556, 46, 559, 562, 52, 568, 58, 571, 61, 64, 577, 67, 583, 73, 586, 76, 589, 79, 592, 82, 598, 88, 601, 604, 94, 607, 97, 613, 103, 106, 619, 109, 622, 628, 118, 631, 121, 634, 124, 127, 643, 646, 136, 649, 139, 652, 142, 148, 661, 151, 664, 667, 157, 673, 163, 676, 166, 169, 682, 172, 688, 178, 691, 181, 694, 184, 697, 187, 703, 193, 706, 709, 199, 712, 202, 718, 208, 211, 724, 214, 727, 733, 223, 736, 226, 739, 229, 232, 748, 751, 241, 754, 244, 757, 247, 253, 766, 256, 769, 772, 262, 778, 268, 781, 271, 274, 787, 277, 793, 283, 796, 286, 799, 289, 802, 292, 808, 298, 811, 814, 304, 817, 307, 823, 313, 316, 829, 319, 832, 838, 328, 841, 331, 844, 334, 337, 853, 856, 346, 859, 349, 862, 352, 358, 871, 361, 874, 877, 367, 883, 373, 886, 376, 379, 892, 382, 898, 388, 901, 391, 904, 394, 907, 397, 913, 403, 916, 919, 409, 922, 412, 928, 418, 421, 934, 424, 937, 943, 433, 946, 436, 949, 439, 442, 958, 961, 451, 964, 454, 967, 457, 463, 976, 466, 979, 982, 472, 988, 478, 991, 481, 484, 997, 487, 493, 496, 499, 502, 508}
tc = int(input())
while tc > 0:
	n = int(input())
	tc -= 1
	if n % 3 == 0:
		print(f'{int(n / 3)} 0 0')
		continue
	elif n % 5 == 0:
		print(f'0 {int(n / 5)} 0')
		continue
	elif n % 7 == 0:
		print(f'0 0 {int(n / 7)}')
		continue
	elif n in a:
		print(f'{int((n - 5) / 3)} 1 0')
		continue
	elif n in b:
		print(f'{int((n - 7) / 3)} 0 1')
		continue
	else:
		print('-1')
		continue


for i in range(int(input())):
	n = int(input())
	c = 0
	for _7 in range(150):
		for _5 in range(205):
			sm = 7 * _7 + 5 * _5
			if sm > n:
				break
			if (n - sm) % 3 == 0:
				c = 1
				ans = [(n - sm) // 3, _5, _7]
				break
		if c:
			break
	if c:
		print(*ans)
	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())
while t:
	t -= 1
	n = int(input())
	if n % 3 == 0:
		print(int(n / 3), 0, 0)
	elif n % 5 == 0:
		print(0, int(n / 5), 0)
	elif n % 7 == 0:
		print(0, 0, int(n / 7))
	else:
		flag = 0
		for i in range(201):
			if n - i * 5 >= 0 and (n - i * 5) % 3 == 0:
				print(int((n - i * 5) / 3), int(i), 0)
				flag += 1
				break
		if flag == 0:
			print(-1)


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)


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		(a1, a2, a3) = (0, 0, 0)
		(b1, b2, b3) = (0, 0, 0)
		(c1, c2, c3) = (0, 0, 0)
		(n1, n2, n3) = (n, n, n)
		while n1 > 0:
			n1 = n1 - 7
			c1 = c1 + 1
			if n1 < 0:
				break
			if n1 % 3 == 0:
				a1 = n1 // 3
				n1 = 0
				break
			elif n1 % 5 == 0:
				b1 = n1 // 5
				n1 = 0
				break
		while n2 > 0:
			n2 = n2 - 3
			a2 = a2 + 1
			if n2 < 0:
				break
			if n2 % 7 == 0:
				c2 = n2 // 7
				n2 = 0
				break
			elif n2 % 5 == 0:
				b2 = n2 // 5
				n2 = 0
				break
		while n3 > 0:
			n3 = n3 - 5
			b3 = b3 + 1
			if n3 < 0:
				break
			if n3 % 7 == 0:
				c3 = n3 // 7
				n3 = 0
				break
			elif n3 % 5 == 0:
				b3 = n3 // 5
				n3 = 0
				break
		if n1 < 0 and n2 < 0 and (n3 < 0):
			print(-1)
		elif n1 == 0:
			print(a1, b1, c1)
		elif n2 == 0:
			print(a2, b2, c2)
		elif n3 == 0:
			print(a3, b3, c3)


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		res = []
		for j in range(n // 3 + 1):
			for k in range(n // 5 + 1):
				z = (n - 3 * j - 5 * k) % 7
				ans = (n - 3 * j - 5 * k) // 7
				if z >= 0 and z == 0:
					res.append(j)
					res.append(k)
					res.append(ans)
					break
			if len(res) != 0:
				print(res[0], end=' ')
				print(res[1], end=' ')
				print(res[2])
				break
		if len(res) == 0:
			print(-1)
except:
	pass


t = int(input())
while t > 0:
	t = t - 1
	(p, q) = (-1, -1)
	n = int(input())
	x = n // 3
	x += 1
	if n == 1 or n == 2 or n == 4:
		print('-1')
		continue
	if n % 3 == 0:
		print(n // 3, end=' ')
		print('0', '0')
		continue
	if n % 7 == 0:
		print('0', '0', end=' ')
		print(n // 7)
		continue
	if n % 5 == 0:
		print('0', end=' ')
		print(n // 5, end=' ')
		print('0')
		continue
	if n % 3 == 1:
		print((n - 7) // 3, '0', '1')
	else:
		print((n - 5) // 3, '1', '0')


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 sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		f = False
		ans = []
		for i in range(1000):
			if i * 7 > N:
				break
			for j in range(1000):
				x = i * 7 + j * 5
				if x > N:
					break
				y = N - x
				if y % 3 == 0:
					ans.append(y // 3)
					ans.append(j)
					ans.append(i)
					f = True
					break
			if f:
				break
		if f:
			print(*ans)
		else:
			print(-1)
main()


for _ in range(int(input())):
	r = int(input())
	(t, f, s) = (0, 0, 0)
	tol = 0
	flag = False
	for n in range(0, 99999):
		t = n % 10
		f = n % 100 // 10
		s = n // 100
		tol = 3 * t + f * 5 + s * 7
		if tol == r:
			print(t, f, s)
			flag = True
			break
	if not flag:
		print(-1)


t = int(input())
for l in range(t):
	n = int(input())
	res = [0] * 3
	if n % 5 == 0:
		res[1] = n // 5
		for e in res:
			print(e, end=' ')
		print()
		continue
	elif n % 7 == 0:
		res[2] = n // 7
		for e in res:
			print(e, end=' ')
		print()
		continue
	elif n % 3 == 0:
		res[0] = n // 3
		for e in res:
			print(e, end=' ')
		print()
		continue
	if n < 10:
		if n == 8:
			lis = [1, 1, 0]
			for e in lis:
				print(e, end=' ')
			print()
			continue
		else:
			print(-1)
			continue
	if n == 11:
		lis = [2, 1, 0]
		for e in lis:
			print(e, end=' ')
		print()
		continue
	od = n % 10
	rm = n - od
	if od == 7:
		res[2] = 1
		res[1] = rm // 5
		for e in res:
			print(e, end=' ')
		print()
		continue
	if od == 3 or od == 6 or od == 9:
		res[0] = od // 3
		res[1] = rm // 5
		for e in res:
			print(e, end=' ')
		print()
		continue
	dic = {1: 20, 2: 10, 4: 20, 8: 10}
	if rm - dic[od] < 0:
		print(-1)
		continue
	else:
		res[0] = (od + dic[od]) // 3
		res[1] = (rm - dic[od]) // 5
		for e in res:
			print(e, end=' ')
		print()
		continue


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)


for _ in range(int(input())):
	n = int(input())
	flag = False
	ans = -1
	for i in range(n):
		if ans != -1:
			break
		for r in range(n):
			if i * 7 + r * 5 > n:
				break
			if (n - i * 7 - r * 5) % 3 == 0:
				ans = ((n - i * 7 - r * 5) // 3, r, i)
				break
	if ans == -1:
		print(ans)
	else:
		print(*ans)


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


n = int(input())
while n:
	n -= 1
	num = int(input())

	def find(num):
		for a in range(num // 7 + 1):
			res1 = num - 7 * a
			for b in range(res1 // 5 + 1):
				res2 = res1 - 5 * b
				for c in range(res2 // 3 + 1):
					res3 = res2 - c * 3
					if res3 == 0:
						return [a, b, c]
		return -1
	res = find(num)
	if res == -1:
		print(-1)
	else:
		print(res[2], res[1], res[0])


for _ in range(int(input())):
	n = int(input())
	c5 = 0
	c3 = 0
	c7 = 0
	r = n % 10
	c5 = (n - r) // 5
	if r == 1:
		c5 -= 1
		c3 += 2
	elif r == 2:
		c5 -= 1
		c7 += 1
	elif r == 3:
		c3 += 1
	elif r == 4:
		c5 -= 1
		c3 += 3
	elif r == 5:
		c5 += 1
	elif r == 6:
		c3 += 2
	elif r == 7:
		c7 += 1
	elif r == 8:
		c5 += 1
		c3 += 1
	elif r == 9:
		c3 += 3
	if c5 < 0 or c3 < 0 or c7 < 0:
		print(-1)
	else:
		print(c3, c5, c7)


def main():
	import sys
	sys.setrecursionlimit(311111)
	ikimasu = sys.stdin.buffer.readline
	ini = lambda : int(ins())
	ina = lambda : list(map(int, ikimasu().split()))
	ins = lambda : ikimasu().strip()
	t = ini()
	for _ in range(t):
		x = ini()
		if x < 5 and x != 3:
			print(-1)
			continue
		if x < 5 and x == 3:
			print(1, 0, 0)
			continue
		tmpx = x % 5
		if tmpx == 0:
			print(0, x // 5, 0)
		if tmpx == 1:
			print(2, x // 5 - 1, 0)
		if tmpx == 2:
			print(0, x // 5 - 1, 1)
		if tmpx == 3:
			print(1, x // 5, 0)
		if tmpx == 4:
			print(3, x // 5 - 1, 0)
main()


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 func2(number):
	if number == 1:
		return (-1, 0, 0)
	if number == 2:
		return (-1, 0, 0)
	if number == 3:
		return (0, 0, 1)
	if number == 4:
		return (-1, 0, 0)
	if number == 5:
		return (0, 1, 0)
	if number == 6:
		return (0, 0, 2)
	if number == 7:
		return (1, 0, 0)
	if number == 8:
		return (0, 1, 1)
	if number == 9:
		return (0, 0, 3)
	if number == 10:
		return (0, 2, 0)
	if number == 11:
		return (0, 1, 2)
	if number == 12:
		return (0, 0, 4)
	if number == 13:
		return (0, 2, 1)
	if number == 14:
		return (2, 0, 0)
	if number == 15:
		return (0, 3, 0)
	if number == 16:
		return (0, 2, 2)
	if number == 17:
		return (1, 2, 0)
	if number == 18:
		return (0, 3, 1)
	if number == 19:
		return (0, 3, 3)
	if number == 20:
		return (0, 4, 0)

def func():
	n = int(input())
	n7 = 0
	n5 = 0
	n3 = 0
	if n <= 10:
		(n7, n5, n3) = func2(n)
	else:
		x = n % 10
		y = n // 10
		if x <= 4:
			y = y - 1
			x = x + 10
		(n7, n5, n3) = func2(x)
		n5 = n5 + y * 2
	if n7 == -1:
		print(-1)
		return
	print(n3, n5, n7)
	return
numTest = int(input())
while numTest:
	numTest -= 1
	func()


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)


from bisect import *
from collections import *
from random import *
from decimal import *
from itertools import *
import sys
input = sys.stdin.readline

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

def st():
	return input().rstrip('\n')

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

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	if n == 7:
		print(0, 0, 1)
		continue
	fl = 0
	for i in range(400):
		if (n - 3 * i) % 5 == 0 and n - 3 * i >= 0:
			fl = 1
			print(i, (n - 3 * i) // 5, 0)
			break
	if fl == 0:
		print(-1)


t = int(input())
for i in range(t):
	num = int(input())
	if num % 3 == 0:
		print(str(int(num // 3)) + ' 0 0')
	elif num % 5 == 0:
		print('0 ' + str(int(num // 5)) + ' 0')
	elif num % 7 == 0:
		print('0 0 ' + str(int(num // 7)))
	else:
		no3 = num // 3
		no5 = no3 - 1
		no7 = no3 - 2
		if num % 3 == 2:
			if no5 * 3 + 5 == num and no5 >= 1:
				print(str(no5) + ' 1 0')
			else:
				print('-1')
		elif num % 3 == 1:
			if no7 * 3 + 7 == num and no7 >= 1:
				print(str(no7) + ' 0 1')
			else:
				print('-1')


def solve(q):
	for i in range(1001):
		total = i * 3
		if total == q:
			return [i, 0, 0]
		elif total > q:
			return -1
		for j in range(1001):
			total += j * 5
			if total > q:
				break
			k = (q - total) // 7
			if i * 3 + j * 5 + k * 7 == q:
				return [i, j, k]
	return -1
T = int(input())
for _ in range(T):
	q = int(input())
	res = solve(q)
	if res == -1:
		print(res)
	else:
		print(*res)


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)


a = int(input())
for w in range(a):
	ok = False
	x = int(input())
	for i in range(1000):
		if i * 3 > x or ok:
			break
		for j in range(1000):
			if i * 3 + j * 5 > x or ok:
				break
			for l in range(1000):
				if i * 3 + j * 5 + l * 7 > x:
					break
				if i * 3 + j * 5 + l * 7 == x:
					print(i, j, l, sep=' ')
					ok = True
					break
	if ok == False:
		print(-1)


import math

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

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	n = int(input())
	flag = 0
	for i in range(0, n // 7 + 1):
		for j in range(0, n // 5 + 1):
			x = n - i * 7 - j * 5
			if x % 3 == 0:
				print(x // 3, j, i)
				flag = 1
				break
		if flag == 1:
			break
	if flag == 0:
		print('-1')


def solution():
	n = int(input())
	fivesCount = n // 5
	mod5 = n % 5
	if mod5 == 0:
		print(0, fivesCount, 0)
		return
	if mod5 == 1:
		if fivesCount >= 1:
			print(2, fivesCount - 1, 0)
			return
		else:
			print(-1)
	if mod5 == 2:
		if fivesCount >= 1:
			print(0, fivesCount - 1, 1)
			return
		else:
			print(-1)
	if mod5 == 3:
		print(1, fivesCount, 0)
		return
	if mod5 == 4:
		if fivesCount >= 1:
			print(3, fivesCount - 1, 0)
			return
		else:
			print(-1)
T = int(input())
while T:
	solution()
	T -= 1


from sys import stdin

def ip():
	return [int(i) for i in stdin.readline().split()]

def sp():
	return [str(i) for i in stdin.readline().split()]

def solve(n):
	t1 = t2 = n
	(three, five, seven) = (0, 0, 0)
	if n % 3 == 0:
		return [True, int(n / 3), 0, 0]
	elif n % 5 == 0:
		return [True, 0, int(n / 5), 0]
	elif n % 7 == 0:
		return [True, 0, 0, int(n / 7)]
	while t1 >= 7:
		t1 -= 7
		seven += 1
		if t1 % 3 == 0:
			three += int(t1 / 3)
			return [True, three, five, seven]
		elif t1 % 5 == 0:
			five += int(t1 / 5)
			return [True, three, five, seven]
	(three, five, seven) = (0, 0, 0)
	while t2 >= 5:
		t2 -= 5
		five += 1
		if t2 % 3 == 0:
			three += int(t2 / 3)
			return [True, three, five, seven]
	if 3 * three + 5 * five + 7 * seven != n:
		return [False, 0, 0, 0]
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 0:
		print(0)
	elif n < 3:
		print(-1)
		continue
	(flag, t, f, s) = solve(n)
	if flag:
		print(t, f, s)
	else:
		print(-1)


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)


for _ in range(int(input())):
	n = int(input())
	flag = False
	for i in range(n // 5 + 1):
		if flag:
			break
		for j in range(n // 7 + 1):
			if (n - 5 * i - 7 * j) % 3 == 0:
				print(f'{(n - 5 * i - 7 * j) // 3}  {i}  {j}')
				flag = True
				break
	if not flag:
		print(-1)


from collections import defaultdict
res = defaultdict(lambda : {3: 0, 5: 0, 7: 0})
arr = [False] * 1001
arr[0] = True
res[0] = {3: 0, 5: 0, 7: 0}
for i in range(1, 1001):
	if i - 7 >= 0 and arr[i - 7]:
		arr[i] = True
		temp = res[i - 7]
		res[i][3] = temp[3]
		res[i][5] = temp[5]
		res[i][7] = temp[7] + 1
	elif i - 5 >= 0 and arr[i - 5]:
		arr[i] = True
		temp = res[i - 5]
		res[i][3] = temp[3]
		res[i][5] = temp[5] + 1
		res[i][7] = temp[7]
	elif i - 3 >= 0 and arr[i - 3]:
		arr[i] = True
		temp = res[i - 3]
		res[i][3] = temp[3] + 1
		res[i][5] = temp[5]
		res[i][7] = temp[7]
	else:
		arr[i] = False
		res[i] = {3: 0, 5: 0, 7: 0}
t = int(input())
result = []
for _ in range(t):
	n = int(input())
	if arr[n]:
		result.append(str(res[n][3]) + ' ' + str(res[n][5]) + ' ' + str(res[n][7]))
	else:
		result.append('-1')
print(*result, sep='\n')


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

def print(*args, end='\n'):
	s = []
	for i in args:
		s.append(str(i) + ' ')
	s = ''.join(s)
	stdout.write(s + end)

def solve():
	n = int(input())
	flag = 0
	for i in range(0, 100):
		x = i
		if 3 * x > n:
			break
		for j in range(0, 100):
			y = j
			ans = n - 3 * x - 5 * y
			if ans >= 0 and ans % 7 == 0:
				flag = 1
				print(x, y, ans // 7)
				return
	print(-1)
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


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)


test = int(input())
for _ in range(test):
	n = int(input())
	ans = []
	flag = False
	for i in range(n // 3 + 1):
		a = n - 3 * i
		for j in range(n // 5 + 1):
			b = a - j * 5
			for k in range(n // 7 + 1):
				c = b - k * 7
				if c == 0:
					ans = [i, j, k]
					flag = True
					break
			if flag:
				break
		if flag:
			break
	if len(ans) == 0:
		print(-1)
	else:
		print(*ans)


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()


n = int(input())
for i in range(n):
	stop_entry = 0
	p = 0
	w = int(input())
	while w > 0:
		if w % 3 == 0:
			print(w // 3, p, 0)
			break
		elif w % 5 == 0 and stop_entry == 0:
			print(0, w // 5, 0)
			break
		elif w % 7 == 0 and stop_entry == 0:
			print(0, 0, w // 7)
			break
		else:
			stop_entry = 1
			w -= 5
			p += 1
	else:
		print(-1)


a = int(input())
for i in range(0, a):
	b = int(input())
	k = 0
	for i in range(0, b // 3 + 1):
		ptemp = b - i * 3
		for j in range(0, b // 5 + 1):
			temp = ptemp - j * 5
			if temp % 7 == 0:
				k = 1
				print(i, j, temp // 7)
				break
		if k == 1:
			break
	if k == 0:
		print(-1)


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()))


for _ in range(int(input())):
	n = int(input())
	c = 0
	while n >= 14:
		n -= 7
		c += 1
	if n == 13:
		r = [1, 2, c]
	elif n == 12:
		r = [0, 1, c + 1]
	elif n == 11:
		r = [2, 1, c]
	elif n == 10:
		r = [0, 2, c]
	elif n == 9:
		r = [3, 0, c]
	elif n == 8:
		r = [1, 1, c]
	elif n == 7:
		r = [0, 0, c + 1]
	elif n == 6:
		r = [2, 0, c]
	elif n == 5:
		r = [0, 1, c]
	elif n == 4:
		r = -1
	elif n == 3:
		r = [1, 0, c]
	elif n == 2:
		r = -1
	elif n == 1:
		r = -1
	if r == -1:
		print(-1)
	else:
		print(*r)


t = int(input())
for i in range(t):
	n = int(input())
	tc = 0
	fc = 0
	sc = 0
	if n % 3 == 0:
		tc += n // 3
		print(tc, fc, sc)
	elif n % 5 == 0:
		fc += n // 5
		print(tc, fc, sc)
	elif n % 7 == 0:
		sc += n // 7
		print(tc, fc, sc)
	elif n < 5:
		print(-1)
	elif n % 10 % 3 == 0:
		fc = n // 10 * 2
		tc = n % 10 // 3
		print(tc, fc, sc)
	elif n % 10 == 7:
		fc = n // 10 * 2
		sc = 1
		print(tc, fc, sc)
	elif n % 10 == 8:
		fc = n // 5
		tc = 1
		print(tc, fc, sc)
	else:
		fc = n // 5 - 1
		temp = n - 5 * fc
		if temp % 3 == 0:
			tc = temp / 3
		elif temp % 7 == 0:
			sc = temp / 7
		print(int(tc), int(fc), int(sc))


for tt in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
		continue
	if n % 5 == 0:
		print(0, n // 5, 0)
		continue
	if n % 7 == 0:
		print(0, 0, n // 7)
		continue
	b = True
	for i in range(0, n // 5 + 1):
		for j in range(0, n // 7 + 1):
			if 5 * i + 7 * j > n:
				break
			if (n - 5 * i - 7 * j) % 3 == 0:
				print((n - 5 * i - 7 * j) // 3, i, j)
				b = False
				break
		if not b:
			break
	if b:
		print(-1)


for i in range(int(input())):
	n = int(input())
	if n % 7 == 0:
		print(0, 0, n // 7)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 3 == 0:
		print(n // 3, 0, 0)
	else:
		s = 0
		c = 0
		while n > 1:
			if n % 5 == 0:
				s = n // 5
				n = n % 5
			c += 1
			n -= 3
		if s == 0:
			print(-1)
		else:
			print(c - 1, s, 0)


def NoA(n):
	if n < 3:
		return [-1]
	if n == 3:
		return [3]
	if n == 5:
		return [5]
	if n == 7:
		return [7]
	if n == 10:
		return [5, 5]
	if n == 14:
		return [7, 7]
	return [3] + NoA(n - 3)
for _ in range(int(input())):
	n = int(input())
	k = NoA(n)
	if k[-1] == -1:
		print(-1)
	else:
		print(*[k.count(3), k.count(5), k.count(7)])


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)


t = int(input())
for _ in range(t):
	n = int(input())
	if n < 3:
		print(-1)
		continue
	if n == 3:
		print(1, end=' ')
		print(0, end=' ')
		print(0)
		continue
	if n == 4:
		print(-1)
		continue
	if n == 5:
		print(0, end=' ')
		print(1, end=' ')
		print(0)
		continue
	if n == 6:
		print(2, end=' ')
		print(0, end=' ')
		print(0)
		continue
	if n == 7:
		print(0, end=' ')
		print(0, end=' ')
		print(1)
		continue
	a = n % 7
	b = n // 7
	if a == 0:
		print(0, end=' ')
		print(0, end=' ')
		print(b)
		continue
	if a == 1:
		print(1, end=' ')
		print(1, end=' ')
		print(b - 1)
		continue
	if a == 2:
		print(3, end=' ')
		print(0, end=' ')
		print(b - 1)
		continue
	if a == 3:
		print(1, end=' ')
		print(0, end=' ')
		print(b)
		continue
	if a == 4:
		print(2, end=' ')
		print(1, end=' ')
		print(b - 1)
		continue
	if a == 5:
		print(0, end=' ')
		print(1, end=' ')
		print(b)
		continue
	if a == 6:
		print(2, end=' ')
		print(0, end=' ')
		print(b)


import sys

def solve(windows: int, num_3: int, num_5: int, num_7: int) -> list:
	if windows == 0:
		return [num_3, num_5, num_7]
	if windows > 0:
		return solve(windows - 3, num_3 + 1, num_5, num_7) or solve(windows - 5, num_3, num_5 + 1, num_7) or solve(windows - 7, num_3, num_5, num_7 + 1)
	return []
for (count, line) in enumerate(sys.stdin):
	if count == 0:
		continue
	result = solve(int(line), 0, 0, 0)
	if result:
		for i in result:
			print(i, end=' ')
		print()
	else:
		print(-1)


def solve(n):
	i = 0
	while 3 * i <= n:
		j = 0
		while 3 * i + 5 * j <= n:
			k = 0
			while 3 * i + 5 * j + 7 * k <= n:
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k, sep=' ')
					return
				k += 1
			j += 1
		i += 1
	print('-1')
for i in range(int(input())):
	n = int(input())
	solve(n)


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)


for _ in range(int(input())):
	n = int(input())
	ok = False
	for seven in range(0, n + 1, 7):
		nn = n - seven
		for five in range(0, nn + 1, 5):
			(d, m) = divmod(nn - five, 3)
			if m == 0:
				print(d, five // 5, seven // 7)
				break
		else:
			continue
		break
	else:
		print(-1)


for tt in range(int(input())):
	n = int(input())
	f = 0
	for i in range(0, n + 1, 3):
		if (n - i) % 3 == 0:
			f = 1
			print(n // 3, 0, 0)
			break
		elif (n - i) % 5 == 0:
			f = 1
			print(i // 3, (n - i) // 5, 0)
			break
		elif (n - i) % 7 == 0:
			f = 1
			print(i // 3, 0, (n - i) // 7)
			break
	if not f:
		print(-1)


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


t = int(input())
for i in range(t):
	target = int(input())
	x = []
	n = target // 3 + 1
	n2 = target // 5 + 1
	k = 0
	for i in range(0, n):
		for j in range(0, n2):
			z = target - 3 * i - 5 * j
			if z % 7 == 0:
				r = z // 7
				if 3 * i + 5 * j + 7 * r == target:
					print(i, j, r)
					k = 1
					break
		if k == 1:
			break
	if k == 0:
		print(-1)


def m7(c, n):
	if n == 0:
		return c
	return m7(c + 1, n - 7)

def m5(c, n):
	if n == 0:
		return c
	return m5(c + 1, n - 5)

def m3(c, n):
	if n == 0:
		return c
	return m3(c + 1, n - 3)
t = int(input())
arr = []
for i in range(t):
	arr.append(int(input()))
for i in arr:
	a = 0
	b = 0
	c = 0
	if 1 * 3 + 1 * 5 + 1 * 7 < i:
		while a * 3 + b * 5 + c * 7 < i:
			a += 1
			while a * 3 + b * 5 + c * 7 < i:
				b += 1
				while a * 3 + b * 5 + c * 7 < i:
					c += 1
				if a * 3 + b * 5 + c * 7 != i:
					c = 0
			if a * 3 + b * 5 + c * 7 != i:
				b = 0
		if a * 3 + b * 5 + c * 7 == i:
			print(a, b, c)
		else:
			print(-1)
	else:
		a = 1
		b = 1
		c = 1
		if a * 3 + b * 5 + c * 7 == i:
			print(a, b, c)
		elif a * 3 + b * 5 == i:
			print(a, b, 0)
		elif a * 3 + c * 7 == i:
			print(a, 0, c)
		elif b * 5 + c * 7 == i:
			print(0, b, c)
		elif i == 11:
			print(2, 1, 0)
		elif i == 13:
			print(1, 2, 0)
		else:
			x = 0
			if i % 7 == 0:
				z = m7(x, i)
				print(0, 0, z)
			elif i % 5 == 0:
				z = m5(x, i)
				print(0, z, 0)
			elif i % 3 == 0:
				z = m3(x, i)
				print(z, 0, 0)
			else:
				print(-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)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	g = 0
	ans = None
	for i in range(n // 2 + 1):
		for j in range(n // 3 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					g = 1
					ans = (i, j, k)
					break
			if g:
				break
		if g:
			break
	if g:
		print(*ans)
	else:
		print(-1)


def isw(on):
	a = [3, 5, 7]
	if on < 3 or on == 4:
		return -1
	elif on % 3 == 0:
		return [on // 3, 0, 0]
	elif on % 3 == 1:
		return [(on - 7) // 3, 0, 1]
	else:
		return [(on - 5) // 3, 1, 0]
t = int(input())
svs = list()
for i in range(0, t):
	n = int(input())
	s = isw(n)
	svs.append(s)
for a in svs:
	t = ''
	if a != -1:
		for k in a:
			t = t + str(k) + ' '
	else:
		t = '-1'
	print(t)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

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

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
he = []
he.append([3, 1, 0, 0])
he.append([5, 0, 1, 0])
he.append([7, 0, 0, 1])
d = defaultdict(list)
visited = {}
visited[3] = 1
visited[5] = 1
visited[7] = 1
while he[0][0] <= 1000:
	(cost, a, b, c) = heappop(he)
	d[cost].append([a, b, c])
	if cost + 3 not in visited:
		heappush(he, [cost + 3, a + 1, b, c])
		visited[cost + 3] = 1
	if cost + 5 not in visited:
		heappush(he, [cost + 5, a, b + 1, c])
		visited[cost + 5] = 1
	if cost + 7 not in visited:
		heappush(he, [cost + 7, a, b, c + 1])
		visited[cost + 7] = 1
for _ in range(val()):
	n = val()
	if n not in visited:
		print(-1)
	else:
		print(*d[n][0])


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])


t = int(input())

def solve(n, t=0, f=0, s=0):
	if n < 3:
		return False
	if n % 3 == 0:
		return [n // 3 + t, f, s]
	elif n % 5 == 0:
		return [t, f + n // 5, s]
	elif n % 7 == 0:
		return [t, f, s + n // 7]
	else:
		tmp = solve(n - 3, t + 1, f, s)
		if not tmp:
			tmp = solve(n - 5, t, f + 1, s)
		if not tmp:
			tmp = solve(n - 7, t, f, s + 1)
		if not tmp:
			return [0, 0, 0]
		return tmp
for i in range(t):
	n = int(input())
	sol = solve(n)
	if not sol or sol == [0, 0, 0]:
		print(-1)
	else:
		print(' '.join([str(x) for x in sol]))


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)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.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()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

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

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

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def N():
	return int(inp())

def solve():
	n = N()
	ans = -1
	for a in range(200):
		for b in range(300):
			k = n - 7 * a - 5 * b
			if k % 3 == 0 and k >= 0:
				print(k // 3, b, a)
				return
	print(-1)
testcase(int(inp()))


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))


import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		(n3, n5, n7) = (0, 0, 0)
		if n % 10 == 1:
			n3 += 2
			n5 += 1
			n -= 10
		elif n % 10 == 2:
			n3 += 4
			n -= 10
		elif n % 10 == 3:
			n3 += 1
		elif n % 10 == 4:
			n7 += 2
			n -= 10
		elif n % 10 == 5:
			n5 += 1
		elif n % 10 == 6:
			n3 += 2
		elif n % 10 == 7:
			n7 += 1
		elif n % 10 == 8:
			n3 += 1
			n5 += 1
		elif n % 10 == 9:
			n3 += 3
		n3 += n // 10
		n7 += n // 10
		print(n3, n5, n7)


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 _ in range(int(input())):
	n = int(input())
	if n not in [1, 2, 4]:
		t = 0
		p = 0
		s = 0
		if n % 5 not in [1, 2, 4]:
			p = n // 5
			t = int(n % 5 == 3)
			print(t, p, s)
		else:
			p = (n - 5) // 5
			n -= p * 5
			if n == 6:
				t += 2
			elif n == 7:
				s += 1
			else:
				t += 3
			print(t, p, s)
	else:
		print(-1)


for test in range(int(input())):
	n = int(input())
	(n3, n5, n7) = (0, 0, 0)
	bad = set((1, 2, 4))
	res = ''
	if n not in bad:
		if n % 3 == 0:
			n3 = n // 3
		elif n % 7 == 0:
			n7 = n // 7
		else:
			q = n % 5
			if q == 0:
				n5 = n // 5
			elif q == 1:
				n3 = 2
				n5 = (n - 6) // 5
			elif q == 2:
				n7 = 1
				n5 = (n - 7) // 5
			elif q == 3:
				n3 = 1
				n5 = (n - 3) // 5
			elif q == 4:
				n7 = 2
				n5 = (n - 14) // 5
		res = ' '.join(map(str, [n3, n5, n7]))
	else:
		res = -1
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	solved = False
	for x in range(0, n + 1, 3):
		for y in range(0, n + 1, 5):
			if x + y > n:
				break
			for z in range(0, n + 1, 7):
				if x + y + z > n:
					break
				if x + y + z == n:
					print(x // 3, y // 5, z // 7)
					solved = True
					break
			if solved:
				break
		if solved:
			break
	else:
		print(-1)


l = [[-2 for i in range(3)] for j in range(1001)]
for _ in range(int(input())):
	n = int(input())
	x = n // 7 + 1
	y = n // 5 + 1
	tt = 0
	if l[n][0] != -2:
		if l[n][0] == -1:
			print(-1)
		else:
			print(l[n][0], l[n][1], l[n][2])
	else:
		for i in range(x + 1):
			for j in range(y + 1):
				ans = (n - (7 * i + 5 * j)) // 3
				if (n - (7 * i + 5 * j)) % 3 == 0 and ans >= 0:
					ans = (n - (7 * i + 5 * j)) // 3
					tt = 1
					break
			if tt == 1:
				break
		if tt == 1:
			l[n][0] = ans
			l[n][1] = j
			l[n][2] = i
			print(ans, j, i)
		else:
			l[n][0] = -1
			print(-1)


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)


def solve(n):
	for x in range(0, n + 1, 7):
		for y in range(0, n + 1, 5):
			if (n - x - y) % 3 == 0:
				print((n - x - y) // 3, y // 5, x // 7)
				return
	print(-1)

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


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))


def window(n):
	lnot = [1, 2, 4]
	ans = [0, 0, 0]
	if n in lnot:
		return [-1]
	elif n == 7:
		return [0, 0, 1]
	elif n % 3 == 0:
		return [n // 3, 0, 0]
	else:
		while n % 5 != 0:
			n -= 3
			ans[0] += 1
		ans[1] = n // 5
		return ans
n = int(input())
l = []
for i in range(n):
	j = int(input())
	l.append(window(j))
for i in range(len(l)):
	for j in range(len(l[i])):
		if j == len(l[i]) - 1:
			print(l[i][j], end='\n')
		else:
			print(l[i][j], end=' ')


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')


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

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

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

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

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False

def solve():
	n = getN()
	for i in range(n // 7 + 1):
		for j in range((n - i * 7) // 5 + 1):
			a = n - i * 7 - j * 5
			if a % 3 == 0 and a >= 0:
				print(a // 3, j, i)
				return
	print(-1)
	return
for _ in range(getN()):
	solve()


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


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 3 == 0:
		print(f'{n // 3} 0 0')
	elif n % 5 == 0:
		print(f'0 {n // 5} 0')
	elif n % 7 == 0:
		print(f'0 0 {n // 7}')
	elif n >= 8:
		if (n - 3) % 5 == 0:
			print(f'1 {(n - 3) // 5} 0')
		elif (n - 3) % 7 == 0:
			print(f'1 0 {(n - 3) // 7}')
		elif (n - 7) % 3 == 0:
			print(f'{(n - 7) // 3} 0 1')
		elif (n - 7) % 5 == 0:
			print(f'0 {(n - 7) // 5} 1')
		elif (n - 5) % 3 == 0:
			print(f'{(n - 5) // 3} 1 0')
		elif (n - 5) % 7 == 0:
			print(f'0 1 {(n - 5) // 7}')
		else:
			print(-1)
	else:
		print(-1)


import sys
from collections import deque
from copy import *

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

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

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < m and (a[i][j] != '.')

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
a = [[] for i in range(1000 + 1)]
d = {3: 0, 5: 1, 7: 2}
for i in range(1, 1001):
	for j in [3, 5, 7]:
		if i - j >= 0:
			a[i - j].append(i)
q = deque()
q.append(0)
ans = [[0, 0, 0] for i in range(1001)]
vis = {0: 1}
while len(q):
	z = q[0]
	q.popleft()
	for j in a[z]:
		if j not in vis:
			ans[j] = deepcopy(ans[z])
			ans[j][d[j - z]] += 1
			vis[j] = 1
			q.append(j)
while t > 0:
	t -= 1
	n = fi()
	if ans[n].count(0) < 3:
		print(*ans[n])
	else:
		print(-1)


rms = [3, 5, 7]
for _ in range(int(input())):
	n = int(input())
	n += 1
	first = [0] * n
	value = [0] * n
	for x in range(1, n):
		value[x] = 10 ** 5
		for a in rms:
			if x - a >= 0 and value[x - a] + 1 < value[x]:
				value[x] = value[x - a] + 1
				first[x] = a
	ls1 = []
	n -= 1
	if value[n] < 10 ** 4:
		while n != 0:
			ls1.append(first[n])
			n -= first[n]
		print(ls1.count(3), ls1.count(5), ls1.count(7))
	else:
		print(-1)


from math import sqrt, ceil, gcd
from collections import defaultdict
import heapq

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)
from itertools import permutations

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


n = int(input())
for i in range(n):
	k = int(input())
	flag = 0
	for i in range(0, k // 7 + 1):
		if flag == 1:
			break
		for j in range(0, k // 5 + 1):
			if flag == 1:
				break
			for m in range(0, k // 3 + 1):
				if flag == 1:
					break
				if i * 7 + j * 5 + 3 * m == k:
					flag = 1
					print(m, j, i, sep=' ')
					break
	if flag == 0:
		print(-1)


t = int(input())

def solve():
	n = int(input())
	m3 = int(n / 3) + 1
	m5 = int(n / 5) + 1
	m7 = int(n / 7) + 1
	for a in range(m3):
		for b in range(m5):
			for c in range(m7):
				if a * 3 + b * 5 + c * 7 == n:
					print(a, b, c)
					return
	print(-1)
for i in range(t):
	solve()


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def sli():
	return list(msi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
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}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

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

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 factorial(n):
	return 1 if n == 1 or n == 0 else n * factorial(n - 1)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

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

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def find_lcm(num1, num2):
	if num1 > num2:
		num = num1
		den = num2
	else:
		num = num2
		den = num1
	rem = num % den
	while rem != 0:
		num = den
		den = rem
		rem = num % den
	gcd = den
	lcm = int(int(num1 * num2) / int(gcd))
	return lcm

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def main():
	for _ in range(ii()):
		n = ii()
		if n % 3 == 0:
			print(n // 3, 0, 0)
		elif n % 5 == 0:
			print(0, n // 5, 0)
		elif n % 7 == 0:
			print(0, 0, n // 7)
		elif n > 7:
			if (n - 5) % 3 == 0:
				print((n - 5) // 3, 1, 0)
			elif (n - 7) % 3 == 0:
				print((n - 7) // 3, 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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.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()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
t = int(input())
for test in range(t):
	n = int(input())
	ans = 0
	for i in range(0, n + 1):
		for j in range(0, n + 1):
			a = i * 3 + j * 5
			if a > n:
				break
			if (n - a) % 7 == 0:
				ans = 1
				print(i, j, (n - a) // 7)
				break
		if ans == 1:
			break
	if ans == 0:
		print('-1')


def no_of_apart(n):
	three = 0
	five = 0
	seven = 0
	if n % 7 == 0:
		seven = n // 7
	elif n - 5 > 0 and (n - 5) % 7 == 0:
		seven = (n - 5) // 7
		five = 1
	elif n - 3 > 0 and (n - 3) % 7 == 0:
		seven = (n - 3) // 7
		three = 1
	elif n % 5 == 0:
		five = n // 5
	elif n - 3 > 0 and (n - 3) % 5 == 0:
		five = (n - 3) // 5
		three = 1
	elif n - 7 > 0 and (n - 7) % 5 == 0:
		five = (n - 7) // 5
		seven = 1
	elif n % 3 == 0:
		three = n // 3
	elif n - 5 > 0 and (n - 5) % 3 == 0:
		three = (n - 5) // 3
		five = 1
	elif n - 7 > 0 and (n - 7) % 3 == 0:
		three = (n - 7) // 3
		seven = 1
	if three or five or seven:
		l = [three, five, seven]
	else:
		l = []
	return l
t = int(input())
for _ in range(t):
	n = int(input())
	result = no_of_apart(n)
	if result:
		print(*result, sep=' ')
	else:
		print(-1)


def find(n):
	for (i3, x3) in enumerate(range(0, n + 1, 3)):
		for (i5, x5) in enumerate(range(0, n + 1, 5)):
			for (i7, x7) in enumerate(range(0, n + 1, 7)):
				if x3 + x5 + x7 == n:
					print(i3, i5, i7)
					return
	print(-1)
for i in range(int(input())):
	n = int(input())
	ok = 0
	find(n)


for _ in range(int(input())):
	n = int(input())
	r = n // 5
	x = n % 5
	if n <= 2 or n == 4:
		print(-1)
	elif n == 3:
		print(1, 0, 0)
	elif n == 5:
		print(0, 1, 0)
	elif x == 0 and n > 5:
		print(0, r, 0)
	elif x == 1 and n > 5:
		print(2, r - 1, 0)
	elif x == 2 and n > 5:
		print(0, r - 1, 1)
	elif x == 3 and n > 5:
		print(1, r, 0)
	elif x == 4 and n > 5:
		rem = 4
		while rem % 3 != 0 and rem % 7 != 0 and (r > 0):
			rem += 5
			r -= 1
		if rem % 3 == 0:
			print(rem // 3, r, 0)
		elif rem % 7 == 0:
			print(0, r, rem // 7)
		else:
			print(-1)


def solve(n):
	a1 = n // 7 + 1
	for i in range(a1):
		a2 = n - i * 7
		b1 = a2 // 5 + 1
		for j in range(b1):
			a3 = a2 - j * 5
			if a3 % 3 == 0:
				return (a3 // 3, j, i)
	return -1
for _ in range(int(input())):
	n = int(input())
	ans = solve(n)
	if ans == -1:
		print(-1)
	else:
		print(' '.join(map(str, ans)))


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 i in range(t):
	n = int(input())
	if n < 3:
		print(-1)
	elif n == 4:
		print(-1)
	elif n % 3 == 0:
		b = n // 3
		print(b, 0, 0)
	elif n % 5 == 0:
		a = n // 5
		print(0, a, 0)
	elif n % 7 == 0:
		a = n // 7
		print(0, 0, a)
	elif (n - 7) % 3 == 0:
		a = (n - 7) // 3
		print(a, 0, 1)
	elif (n - 5) % 3 == 0:
		a = (n - 5) // 3
		print(a, 1, 0)
	elif (n - 3) % 5 == 0:
		a = (n - 3) // 5
		print(1, a, 0)
	elif (n - 7) % 5 == 0:
		a = (n - 7) // 5
		print(0, a, 1)
	elif (n - 3) % 7 == 0:
		a = (n - 3) // 7
		print(1, 0, a)
	elif (n - 5) % 7 == 0:
		a = (n - 5) // 7
		print(0, 1, a)


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)


import math

def fn(n):
	for i in range(n // 7 + 1):
		for j in range(n // 5 - i + 1):
			if (n - 5 * j - 7 * i) % 3 == 0 and n - 5 * j - 7 * i >= 0:
				return (i, j, (n - 7 * i - 5 * j) // 3)
	return (-1, -1, -1)
for _ in range(int(input())):
	n = int(input())
	(i, j, k) = fn(n)
	if i == -1:
		print('-1')
	else:
		print(k, j, i)


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())
	r_7 = n // 7
	r_5 = n // 5
	r_3 = n // 3
	l = 0
	m = 0
	for i in range(r_7 + 1):
		if m == 1:
			break
		for j in range(r_5 + 1):
			if l == 1:
				m = 1
				break
			for k in range(r_3 + 1):
				if i * 7 + j * 5 + k * 3 == n:
					print(k, j, i)
					l = 1
					break
	if m == 0 and l == 0:
		print(-1)


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)


dp = []
for i in range(1001):
	tmp = [0, 0, 0]
	dp.append(tmp)
dp[3][0] = dp[5][1] = dp[7][2] = 1
for i in range(1001):
	for j in [3, 5, 7]:
		if i - j >= 0 and dp[i - j] != [0, 0, 0]:
			dp[i] = dp[i - j].copy()
			if j == 3:
				dp[i][0] += 1
			elif j == 5:
				dp[i][1] += 1
			else:
				dp[i][2] += 1
t = int(input())
for i in range(t):
	n = int(input())
	if dp[n] == [0, 0, 0]:
		print(-1)
		continue
	print(*dp[n])


for p in range(int(input())):
	n = int(input())
	ci = True
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					print(i, j, k)
					ci = False
					break
			if ci == False:
				break
		if ci == False:
			break
	if ci == True:
		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)


for _ in range(int(input())):
	n = int(input())
	f = 0
	for i in range(300):
		for j in range(300):
			s = i * 7 + j * 5
			if s <= n:
				if (n - s) % 3 == 0:
					print((n - s) // 3, j, i)
					f = 1
					break
		if f == 1:
			break
	else:
		print(-1)


x = input()
x = int(x)
all = []
for i in range(x):
	t = input()
	all.append(int(t))
for row in all:
	mark = False
	(mx1, mx2, mx3) = (round(row / 3), round(row / 5), round(row / 7))
	for x3 in range(mx3 + 1):
		for x2 in range(mx2 + 1):
			for x1 in range(mx1 + 1):
				sum = x1 * 3 + x2 * 5 + x3 * 7
				if sum == row:
					print(x1, x2, x3)
					mark = True
					break
			if mark:
				break
		if mark:
			break
	if not mark:
		print(-1)


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)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
from itertools import permutations
MOD = pow(10, 9) + 7
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')
dp = [[0, 0, 0] for i in range(1001)]
dp[3] = [1, 0, 0]
dp[5] = [0, 1, 0]
dp[7] = [0, 0, 1]
for i in range(1001 - 7):
	if sum(dp[i]) != 0:
		for j in [3, 5, 7]:
			if sum(dp[i + j]) == 0:
				if j == 3:
					dp[i + 3] = [dp[i][0] + 1, dp[i][1], dp[i][2]]
				elif j == 7:
					dp[i + 7] = [dp[i][0], dp[i][1], dp[i][2] + 1]
				elif j == 5:
					dp[i + 5] = [dp[i][0], dp[i][1] + 1, dp[i][2]]
for _ in range(int(input())):
	n = int(input())
	if sum(dp[n]) == 0:
		print(-1)
	else:
		print(*dp[n])


for _ in range(int(input())):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		upper = int(n ** 0.5)
		f = 0
		for i in range(upper + 1):
			for j in range(upper + 1):
				x = 3 * i + 5 * j
				if n - x >= 0 and (n - x) % 7 == 0:
					f = 1
					print(i, j, (n - x) // 7)
					break
			if f:
				break
		if f == 0:
			print(-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)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	for i in range(0, n // 3 + 1):
		for j in range(0, n // 5 + 1):
			if (n - 3 * i - 5 * j) % 7 == 0:
				print(i, j, (n - 3 * i - 5 * j) // 7)
				return
	print(-1)
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	if n in [1, 2, 4]:
		print(-1)
		continue
	(t, f, s) = (0, 0, 0)
	while True:
		if n % 3 == 0:
			print(n // 3, f, s)
			break
		if n % 5 == 0:
			print(t, n // 5, s)
			break
		if n % 7 == 0:
			print(t, f, n // 7)
			break
		n -= 3
		t += 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)


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


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)


def apart():
	temp = 0
	n = int(input())
	for x in range(n // 2 + 1):
		for y in range(n // 2 + 1):
			for z in range(n // 2 + 1):
				if 3 * x + 5 * y + 7 * z == n:
					return (x, y, z)
	return (-1, 0, 0)
t = int(input())
for i in range(t):
	(a, b, c) = apart()
	if b == 0 and c == 0 and (a == -1):
		print(-1)
	else:
		print(a, end=' ')
		print(b, end=' ')
		print(c)


t = int(input())

def np(n):
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		for i in range(151):
			l = n - 7 * i
			for j in range(251):
				l = l - 5 * j
				if l >= 0 and l % 3 == 0:
					print(int(l / 3), ' ', j, ' ', i)
					return
		print(-1)
for i in range(t):
	n = int(input())
	np(n)


t = int(input())
L = []
for _ in range(t):
	n = int(input())
	L.append(n)
for h in L:
	L3 = []
	L5 = []
	L7 = []
	for i in range(int(h / 3) + 5):
		L3.append(3 * i)
		L5.append(5 * i)
		L7.append(7 * i)
	a = len(L3)
	H = 0
	for i in range(a):
		for j in range(a):
			for k in range(a):
				if L3[i] + L5[j] + L7[k] == h:
					print(int(L3[i] / 3), int(L5[j] / 5), int(L7[k] / 7))
					H = 1
					break
			if H == 1:
				break
		if H == 1:
			break
	if H == 0:
		print('-1')


def rooms(n):
	mini = n // 3 + 1
	for i in range(mini):
		for j in range(mini):
			for k in range(mini):
				if 3 * i + 5 * j + 7 * k == n:
					return str(i) + ' ' + str(j) + ' ' + str(k)
	return -1
t = int(input())
for i in range(t):
	print(rooms(int(input())))


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def valid(row, col, rows, cols, rcross, lcross):
	return rows[row] == 0 and cols[col] == 0 and (rcross[col + row] == 0) and (lcross[col - row] == 0)

def main():
	ans = ''
	for _ in range(ii()):
		n = ii()
		if n % 3 == 0:
			print(n // 3, 0, 0)
		elif n % 5 == 0:
			print(0, n // 5, 0)
		elif n % 7 == 0:
			print(0, 0, n // 7)
		else:
			flag = 1
			for i in range(1, 1001):
				if 3 * i > n:
					break
				if (n - 3 * i) % 5 == 0:
					flag = 0
					print(i, (n - 3 * i) // 5, 0)
					break
				elif (n - 3 * i) % 7 == 0:
					flag = 0
					print(i, 0, (n - 3 * i) // 7)
					break
			if flag:
				print(-1)
main()


q = int(input())
for _ in range(q):
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	elif n in [1, 2, 4]:
		print(-1)
	elif n == 8:
		print(1, 1, 0)
	elif n == 11:
		print(2, 1, 0)
	elif n == 13:
		print(2, 0, 1)
	else:
		odp = [0, 0, 0]
		while n % 3 != 0:
			n -= 5
			odp[1] += 1
		odp[0] = n // 3
		print(*odp)


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')


t = int(input())
while t:
	n = int(input())
	a = n // 3
	b = n // 5
	c = n // 7
	flag = 0
	for i in range(a + 1):
		for j in range(b + 1):
			for k in range(c + 1):
				if n == i * 3 + j * 5 + k * 7:
					print(i, j, k)
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 0:
		print(-1)
	t -= 1


import sys

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
for _ in range(ri()):
	n = ri()
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		x = n // 5
		y = n % 5
		if y == 1 and x > 0:
			x -= 1
			t = 2
			print(t, x, 0)
		elif y == 2 and x > 0:
			x -= 1
			s = 1
			print(0, x, s)
		elif y == 3:
			print(1, x, 0)
		elif y == 4 and x > 0:
			x -= 1
			print(3, x, 0)
		else:
			wi(-1)


for _ in range(int(input())):
	n = int(input())
	res = [0, 0, 0]
	ok = True
	while n > 0:
		a = [n - 3, n - 5, n - 7]
		if 0 in a:
			if a[0] == 0:
				res[0] += 1
			elif a[1] == 0:
				res[1] += 1
			elif a[2] == 0:
				res[2] += 1
			n = 0
			break
		for item in a:
			if item % 3 == 0:
				res[0] += 1
				n -= 3
				break
			elif item % 5 == 0:
				res[1] += 1
				n -= 5
				break
			elif item % 7 == 0:
				res[2] += 1
				n -= 7
				break
		else:
			ok = False
			break
	if not ok or n != 0:
		print(-1)
	else:
		print(*res)


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()


t = int(input())
for count in range(t):
	n = int(input())
	event = False
	a = n // 3
	b = n // 5
	c = n // 7
	for i in range(0, a + 1):
		for j in range(0, b + 1):
			for k in range(0, c + 1):
				if 3 * i + 5 * j + k * 7 == n:
					event = True
					print(i, j, k)
					break
			if event == True:
				break
		if event == True:
			break
	if event == False:
		print(-1)


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]}')


impossible = [1, 2, 4]
for _ in range(int(input())):
	x = int(input())
	if x in impossible:
		print(-1)
	else:
		ans = []
		if x % 7 == 0:
			ans.append(0)
			ans.append(0)
			ans.append(x // 7)
		elif x % 7 == 3:
			ans.append(1)
			ans.append(0)
			ans.append(x // 7)
		elif x % 7 == 5:
			ans.append(0)
			ans.append(1)
			ans.append(x // 7)
		elif x % 7 == 6:
			ans.append(2)
			ans.append(0)
			ans.append(x // 7)
		elif x % 7 == 1:
			ans.append(1)
			ans.append(1)
			ans.append(x // 7 - 1)
		elif x % 7 == 4:
			ans.append(2)
			ans.append(1)
			ans.append(x // 7 - 1)
		else:
			ans.append(3)
			ans.append(0)
			ans.append(x // 7 - 1)
		print(*ans, sep=' ')


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])


t = int(input())
l = [3, 5, 7]
flag = 0
final = 0

def fun(x, a1, a2, a3):
	global flag
	global final
	if x == 0:
		final = [a1, a2, a3]
		flag = 1
		return
	if flag == 1:
		return
	if x >= 7:
		fun(x - 7, a1 + 1, a2, a3)
	if x >= 5:
		fun(x - 5, a1, a2 + 1, a3)
	if x >= 3:
		fun(x - 3, a1, a2, a3 + 1)
for i in range(t):
	final = [-1]
	flag = 0
	n = int(input())
	fun(n, 0, 0, 0)
	final = final[::-1]
	print(*final)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	if n == 3:
		print(1, 0, 0)
		continue
	(r3, r5, r7) = (0, 0, 0)
	f = 0
	while r3 * 3 <= n:
		c = n - r3 * 3
		(r5, r7) = (0, 0)
		while r5 * 5 <= c:
			c1 = c - r5 * 5
			r7 = 0
			if c1 % 7 == 0:
				f = 1
				r7 = c1 // 7
				break
			r5 += 1
		if f == 1:
			break
		r3 += 1
	if f == 1:
		print(r3, r5, r7)
	else:
		print(-1)


def factor(n):
	numbers = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			numbers.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		numbers.append(n)
	return numbers
for _ in range(int(input())):
	n = int(input())
	c3 = 0
	c5 = 0
	c7 = 0
	if n < 3:
		print(-1)
		continue
	if n % 3 == 0:
		print(n // 3, 0, 0)
		continue
	if n % 5 == 0:
		print(0, n // 5, 0)
		continue
	if n % 7 == 0:
		print(0, 0, n // 7)
		continue
	d = factor(n - 7)
	if 3 in d:
		c7 = 1
		c3 = (n - 7) // 3
		c5 = 0
		print(c3, c5, c7)
		continue
	if 5 in d:
		c7 = 1
		c3 = 0
		c5 = (n - 7) // 5
		print(c3, c5, c7)
		continue
	d = factor(n - 5)
	if 7 in d:
		c7 = (n - 5) // 7
		c3 = 0
		c5 = 1
		print(c3, c5, c7)
		continue
	if 3 in d:
		print((n - 5) // 3, 1, 0)
		continue
	d = factor(n - 3)
	if 7 in d:
		print(1, 0, (n - 3) // 7)
		continue
	if 5 in d:
		print(1, (n - 3) // 5, 0)
		continue
	print(-1)


count = 0

def rec(A, l, w):
	global count
	count += 1
	if w == 0:
		return [0, 0, 0]
	elif w > 0:
		for index in range(l):
			a = A[index]
			res = rec(A, l, w - a)
			if res:
				res[index] += 1
				return res
	else:
		return None

def find(w):
	a = [7, 5, 3]
	x = rec(a, len(a), w)
	if x:
		print(x[2], x[1], x[0])
	else:
		print(-1)

def main():
	T = int(input())
	for t in range(T):
		find(int(input()))
main()


out = []
t = int(input())

def eq(x, y, z):
	return 3 * x + 5 * y + 7 * z
for i in range(t):
	t = 0
	n = int(input())
	if n <= 2:
		out.append(str(-1))
	elif n % 3 == 0:
		out.append(str(str(n // 3) + ' 0 ' + '0'))
	elif n % 5 == 0:
		out.append(str('0 ' + str(n // 5) + ' 0'))
	elif n % 7 == 0:
		out.append(str('0' + ' 0 ' + str(n // 7)))
	else:
		for x in range(0, n // 3 + 1):
			if t == 1:
				break
			for y in range(0, n // 5 + 1):
				if t == 1:
					break
				for z in range(0, n // 7 + 1):
					if t == 1:
						break
					if eq(x, y, z) == n:
						out.append(str(str(x) + ' ' + str(y) + ' ' + str(z)))
						t += 1
		if t != 1:
			out.append(str(-1))
for element in out:
	print(element)


k = int(input())
for o in range(k):
	n = int(input())
	p3 = 0
	p5 = 0
	p7 = 0
	count = 0
	for x in range(n // 7 + 1):
		if count > 0:
			break
		for y in range(n // 5 + 1):
			temp = n - x * 7 - y * 5
			if temp % 3 == 0 and temp >= 0:
				count += 1
				p3 = int(temp / 3)
				p5 = y
				p7 = x
			if count > 0:
				break
	if count == 0:
		print(-1)
	else:
		print(p3, p5, p7)


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


def find_counts(n):
	for c in range(n // 7 + 1):
		n2 = n - c * 7
		for b in range(n2 // 5 + 1):
			n3 = n2 - b * 5
			if n3 % 3 == 0:
				a = n3 // 3
				return [a, b, c]
	return None
n = int(input())
for t in range(n):
	n = int(input())
	result = find_counts(n)
	if result is None:
		print('-1')
	else:
		print(' '.join(map(str, result)))


def calcN(x):
	n = [0, 0, 0]
	while x > 0:
		if x - 7 != 1 and x - 7 != 2 and (x - 7 != 4) and (x - 7 >= 0):
			x = x - 7
			n[2] = n[2] + 1
		elif x - 5 != 1 and x - 5 != 2 and (x - 5 != 4) and (x - 5 >= 0):
			x = x - 5
			n[1] = n[1] + 1
		elif x - 3 != 1 and x - 3 != 2 and (x - 3 != 4) and (x - 3 >= 0):
			x = x - 3
			n[0] = n[0] + 1
		else:
			n = -1
			return n
	return n

def printing(n):
	if n == -1:
		print('-1')
	else:
		print(n[0], ' ', n[1], ' ', n[2])
array = []
number = int(input())
for i in range(0, number, 1):
	array.append(input())
for i in range(0, number, 1):
	printing(calcN(int(array[i])))


def solve(three, five, seven, n):
	if n < 0:
		return [-1, -1, -1]
	if n == 0:
		return [three, five, seven]
	a = solve(three, five, seven + 1, n - 7)
	if a[0] != -1:
		return a
	a = solve(three, five + 1, seven, n - 5)
	if a[0] != -1:
		return a
	a = solve(three + 1, five, seven, n - 3)
	return a
n = int(input())
for i in range(n):
	x = int(input())
	a = solve(0, 0, 0, x)
	if a[0] == -1:
		print(-1)
	else:
		print(a[0], a[1], a[2])


T = int(input())

def check(n):
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return (i, j, k)
	return tuple()
for t in range(T):
	n = int(input())
	res = check(n)
	if len(res) == 0:
		print(-1)
	else:
		print(res[0], res[1], res[2])


def find(num):
	for i in range(num // 3 + 1):
		endflg = False
		for j in range(num // 5 + 1):
			for k in range(num // 7 + 1):
				if i * 3 + j * 5 + k * 7 == num:
					print(i, j, k)
					return
				if i * 3 + j * 5 + k * 7 > num:
					endflg = True
					break
	print(-1)
N = int(input())
for i in range(N):
	window = int(input())
	find(window)


for i in range(int(input())):
	n = int(input())
	a = n % 10
	if n == 1 or n == 2 or n == 4:
		print(-1)
	else:
		if a == 1:
			print(2, (n - 3 * 2) // 5, 0)
		if a == 2:
			print(0, (n - 7) // 5, 1)
		if a == 3 or a == 8:
			print(1, (n - 3) // 5, 0)
		if a == 4:
			print(0, (n - 7 * 2) // 5, 2)
		if a == 6:
			print(2, (n - 3 * 2) // 5, 0)
		if a == 7:
			print(0, (n - 7) // 5, 1)
		if a == 9:
			print(3, (n - 3 * 3) // 5, 0)
		if a == 0 or a == 5:
			print(0, n // 5, 0)


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
for _ in range(int(input())):
	q = int(input())
	l = 0
	for i in range(q // 3 + 2):
		for j in range(q // 5 + 2):
			for k in range(q // 7 + 2):
				if 3 * i + 5 * j + 7 * k == q:
					print(i, j, k)
					l = 1
					break
			if l == 1:
				break
		if l == 1:
			break
	if l == 0:
		print(-1)


d = {3: (1, 0, 0), 5: (0, 1, 0), 6: (2, 0, 0), 7: (0, 0, 1)}
for i in range(5, 1001):
	x = i + 3
	(a, b, c) = d[i]
	d[x] = (a + 1, b, c)
t = int(input())
for i in range(t):
	n = int(input())
	if n not in d:
		print(-1)
		continue
	for x in d[n]:
		print(x, end=' ')
	print('')


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


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

	def rec(n, a, b, c, lis):
		if n == 0:
			lis[0] = a
			lis[1] = b
			lis[2] = c
			return True
		f = False
		if n > 0:
			for (i, item) in enumerate([3, 5, 7]):
				if not f and i == 0:
					f = rec(n - item, a + 1, b, c, lis)
				if not f and i == 1:
					f = rec(n - item, a, b + 1, c, lis)
				if not f and i == 2:
					f = rec(n - item, a, b, c + 1, lis)
		return f
	lis = [0, 0, 0]
	f = rec(n, 0, 0, 0, lis)
	if f:
		for item in lis:
			print(item, end=' ')
		print()
	else:
		print(-1)


def solve(n, a, b, c):
	if n == 0:
		return (a, b, c)
	if n == 1 or n == 2 or n == 4 or (n < 0):
		return (-1, 0, 0)
	if n % 3 == 0:
		return (a + n // 3, b, c)
	if n % 5 == 0:
		return (a, b + n // 5, c)
	if n % 7 == 0:
		return (a, b, n // 7)
	x = solve(n - 3, a + 1, b, c)
	if x != -1:
		return x
	x = solve(n - 5, a, b + 1, c)
	if x != -1:
		return x
	x = solve(n - 7, a, b, c + 1)
	if x[0] != -1:
		return x
	return (-1, 0, 0)
T = int(input())
for _ in range(T):
	N = int(input())
	(a, b, c) = solve(N, 0, 0, 0)
	if a == -1:
		print(-1)
	else:
		print(a, b, c)


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)


import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq

def input():
	return sys.stdin.readline()[:-1]
INF = 10 ** 10

def solve(N):
	for a in range(N // 3 + 1):
		for b in range((N - a * 3) // 5 + 1):
			c = (N - a * 3 - b * 5) // 7
			if a * 3 + b * 5 + c * 7 == N:
				return [a, b, c]
	return [-1]
T0 = int(input())
for _ in range(T0):
	print(*solve(int(input())))


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()


for _ in range(int(input())):
	n = int(input())
	if n < 3:
		print(-1)
		continue
	sp = {0: (0, 0, 0), 3: (1, 0, 0), 5: (0, 1, 0), 7: (0, 0, 1), 8: (1, 1, 0), 10: (1, 0, 1), 12: (0, 1, 1), 15: (1, 1, 1)}
	x = n // 15
	(x3, x5, x7) = (x, x, x)
	temp = n - x * 15
	if temp in sp:
		x3 += sp[temp][0]
		x5 += sp[temp][1]
		x7 += sp[temp][2]
	elif n == 9:
		(x3, x5, x7) = (3, 0, 0)
	else:
		for i in (3, 5, 7):
			if temp - i in sp:
				x3 += sp[temp - i][0] + (i == 3)
				x5 += sp[temp - i][1] + (i == 5)
				x7 += sp[temp - i][2] + (i == 7)
				break
			elif temp + i in sp:
				x3 += sp[temp + i][0] - (i == 3)
				x5 += sp[temp + i][1] - (i == 5)
				x7 += sp[temp + i][2] - (i == 7)
				break
		else:
			(x3, x5, x7) = (-1, -1, -1)
	if min(x3, x5, x7) < 0:
		print(-1)
	else:
		print(x3, x5, x7)


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)


def solve():
	n = int(input())
	for s in range(n // 7 + 2):
		for f in range(n // 5 + 2):
			temp = n - 7 * s - 5 * f
			if temp >= 0 and temp % 3 == 0:
				print(temp // 3, f, s)
				return
	print(-1)
for _ in range(int(input())):
	solve()


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)


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	n = inp()
	if n in [1, 2, 4]:
		print(-1)
		continue
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		(a, b, c) = (0, 0, 0)
		a = n // 3
		rem = n % 3
		if rem == 1:
			print(a - 2, 0, 1)
		elif rem == 2:
			print(a - 1, 1, 0)


for x in range(int(input())):
	a = int(input())
	b = 0
	last = a % 10
	if last != 1 and last != 4 and (last != 2):
		if a % 5 == 0:
			ans = int(a / 5)
			print(b, ans, b)
		elif a % 3 == 0:
			ans = int(a / 3)
			print(ans, b, b)
		elif a % 7 == 0:
			ans = int(a / 7)
			print(b, b, ans)
		else:
			temp = a - last
			ans1 = int(temp / 5)
			if last == 3:
				ele = 1
				print(ele, ans1, b)
			elif last == 6:
				ele = 2
				print(ele, ans1, b)
			elif last == 7:
				ele = 1
				print(b, ans1, ele)
			elif last == 8:
				ele = 1
				ans2 = ans1 + 1
				print(ele, ans2, b)
			elif last == 9:
				ele = 3
				print(ele, ans1, b)
	elif last == 1 and a >= 21:
		temp = a - 21
		op = int(temp / 10)
		c = op + 3
		print(op, b, c)
	elif last == 1 and a < 21 and (a != 1):
		ans1 = 2
		ans2 = 1
		print(ans1, ans2, b)
	elif last == 2 and a != 2:
		temp = a - 12
		op = int(temp / 10)
		c = op + 4
		print(c, b, op)
	elif last == 4 and a != 4:
		temp = a - 14
		op = int(temp / 10)
		c = op + 2
		print(op, b, c)
	else:
		ans = -1
		print(ans)


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()


f = lambda : map(int, input().split())
for _ in range(int(input())):
	fl = 0
	n = int(input())
	for i in range(350):
		for j in range(200):
			if 3 * i + 5 * j > n:
				break
			if (n - (3 * i + 5 * j)) % 7 == 0:
				print(i, j, int((n - (3 * i + 5 * j)) / 7))
				fl = 1
				break
		if fl:
			break
	if fl == 0:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1 or n == 2 or n == 4:
		print(-1)
		continue
	if n % 3 == 0:
		print(int(n / 3), 0, 0)
		continue
	if n % 5 == 0:
		print(0, int(n / 5), 0)
		continue
	if n % 7 == 0:
		print(0, 0, int(n / 7))
		continue
	if n < 10:
		print(1, 1, 0)
		continue
	count_5 = int(n / 5) - 1
	remain = n - count_5 * 5
	count_7 = 0
	count_3 = 0
	if remain == 6:
		print(2, count_5, 0)
	elif remain == 7:
		print(0, count_5, 1)
	elif remain == 8:
		print(1, count_5 + 1, 0)
	elif remain == 9:
		print(3, count_5, 0)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

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

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

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

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

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

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	n = scanner()
	if n == 1 or n == 2 or n == 4:
		print(-1)
		return
	if n % 7 == 0:
		print(0, 0, n // 7)
		return
	if n % 7 == 1:
		print(1, 1, n // 7 - 1)
		return
	if n % 7 == 2:
		print(3, 0, n // 7 - 1)
		return
	if n % 7 == 3:
		print(1, 0, n // 7)
		return
	if n % 7 == 4:
		print(2, 1, n // 7 - 1)
		return
	if n % 7 == 5:
		print(0, 1, n // 7)
		return
	if n % 7 == 6:
		print(2, 0, n // 7)
		return
	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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.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()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


import math
t = int(input())
for w in range(t):
	n = int(input())
	if n == 4 or n < 3:
		print(-1)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 5 == 1:
		print(2, n // 5 - 1, 0)
	elif n % 5 == 2:
		print(0, n // 5 - 1, 1)
	elif n % 5 == 3:
		print(1, n // 5, 0)
	elif n % 5 == 4:
		print(3, n // 5 - 1, 0)


import math
from collections import deque
from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	if n % 3 == 0:
		print(n // 3, 0, 0)
	elif n % 5 == 0:
		print(0, n // 5, 0)
	elif n % 7 == 0:
		print(0, 0, n // 7)
	else:
		found = False
		for i in range(1000):
			for j in range(1000):
				k = 3 * i + 5 * j
				g = n - k
				if g < 0:
					break
				if g % 7 == 0:
					found = True
					print(i, j, g // 7)
					break
			if found:
				break
		if not found:
			print(-1)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = 1
for _ in range(t):
	n = 1000
	dp = [None] * (n + 1)
	if n >= 3:
		dp[3] = {3: 1, 5: 0, 7: 0}
	if n >= 5:
		dp[5] = {3: 0, 5: 1, 7: 0}
	if n >= 7:
		dp[7] = {3: 0, 5: 0, 7: 1}
	dpdic = [None] * (n + 1)
	for i in range(n + 1):
		if i < 3:
			pass
		elif i >= 3 and i < 5:
			if dp[i - 3] == None:
				pass
			else:
				temp = dict(dp[i - 3])
				temp[3] += 1
				dp[i] = dict(temp)
		elif i >= 5 and i < 7:
			if dp[i - 3] == None:
				pass
			else:
				temp = dict(dp[i - 3])
				temp[3] += 1
				dp[i] = dict(temp)
			if dp[i - 5] == None:
				pass
			else:
				temp = dict(dp[i - 5])
				temp[5] += 1
				dp[i] = dict(temp)
		else:
			if dp[i - 3] == None:
				pass
			else:
				temp = dict(dp[i - 3])
				temp[3] += 1
				dp[i] = dict(temp)
			if dp[i - 5] == None:
				pass
			else:
				temp = dict(dp[i - 5])
				temp[5] += 1
				dp[i] = dict(temp)
			if dp[i - 7] == None:
				pass
			else:
				temp = dict(dp[i - 7])
				temp[7] += 1
				dp[i] = dict(temp)
t = ip()
for _ in range(t):
	n = ip()
	if dp[n] == None:
		ans = -1
	else:
		dic = dict(dp[n])
		ans = '{} {} {}'.format(dic[3], dic[5], dic[7])
	out(ans)


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)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict
import bisect

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	n = int(input())
	got = False
	for i in range(1000):
		for j in range(1000):
			if i * 3 + j * 5 == n:
				print(i, j, 0)
				got = True
				break
			if i * 3 + j * 5 > n:
				break
		if got:
			break
	else:
		if n % 7 == 0:
			print(0, 0, n // 7)
		else:
			print('-1')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	(a, b, c) = (0, n // 5, 0)
	rem = n % 5
	if rem == 1:
		a = 2
		b -= 1
	elif rem == 2:
		c = 1
		b -= 1
	elif rem == 3:
		a = 1
	elif rem == 4:
		a = 3
		b -= 1
	if a >= 0 and b >= 0 and (c >= 0) and (a * 3 + b * 5 + c * 7 == n):
		print(a, b, c)
	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])


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


inp = lambda : int(input())
strl = lambda : list(input().strip())
seq = lambda : list(map(int, input().strip().split()))

def results(n):
	for i in range(0, n // 3 + 1):
		for j in range(0, n // 5 + 1):
			for k in range(0, n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return [i, j, k]
	return [-1]

def main():
	t = inp()
	for _ in range(t):
		n = inp()
		result = results(n)
		print(*result)
main()


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)


def count(n):
	(i, j, k) = (0, 0, 0)
	for i in range(n // 3 + 1):
		for j in range(n // 5 + 1):
			for k in range(n // 7 + 1):
				if 3 * i + 5 * j + 7 * k == n:
					return ' '.join([str(i), str(j), str(k)])
	return '-1'
testCases = int(input())
for _ in range(testCases):
	n = int(input())
	print(count(n))