import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
/*
Quarter = 0.25
Dime = 0.10
Nickel = 0.05
Penny = 0.01
그리디 알고리즘으로 풀기
*/
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine()); // 테스트 케이스의 개수
int quarter = 25;
int dime = 10;
int nickel = 5;
int penny = 1;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < t; i++) {
int c = Integer.parseInt(br.readLine()); // 거스름돈
quarter = c / 25;
c %= 25;
dime = c / 10;
c %= 10;
nickel = c / 5;
c %= 5;
penny = c;
System.out.println(quarter + " " + dime + " " + nickel + " " + penny);
}
}
}