#!/usr/bin/env python3
#encoding: windows-1252

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

import sys

if __name__ == "__main__":
    linha = input()
    n = int(linha)

    for x in range(n):
        linha = input()
        valor = int(linha)
        
        n50 = 0
        if valor > 50:
            n50 = int(valor / 50)
            valor -= n50 * 50
            
        n10 = 0
        if valor > 10:
            n10 = int(valor / 10)
            valor -= n10 * 10

        n5 = 0
        if valor > 5:
            n5 = int(valor / 5)
            valor -= n5 * 5

        print("Caso de Teste %i: %i %i %i %i" % ((x+1),n50,n10,n5,valor))

sys.exit()
