for _ in range(int(input())):
c = int(input())
d = [25, 10, 5, 1]
lst = []
for n in d:
lst.append(c // n)
c = c % n
print(*lst)
for _ in range(int(input())):
c = int(input())
d = [25, 10, 5, 1]
lst = []
for n in d:
lst.append(c // n)
c = c % n
print(*lst)