Associated Course(s):
Geeks Classes DSA

Given a value **N**, total sum you have. You have to make change for Rs. N, and there is infinite supply of each of the denominations in Indian currency, i.e., you have infinite supply of { 1, 2, 5, 10, 20, 50, 100, 200, 500, 2000} valued coins/notes, Find the minimum number of coins and/or notes needed to make the change for Rs N.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Each test case consist of an Integer value N denoting the amount to get change for.

**Output:**

Print all the denominations needed to make the change in a separate line.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ N ≤ 10^{6}

**Example:**

**Input:**

1

43

**Output:**

20 20 2 1

**Explanation:
Testcase 1:** Sum of Rs 43 can be changed with minimum of 4 coins/ notes 20, 20, 2, 1.

lakshmi_pandey | 72 |

abbatta7 | 68 |

Ashish Kumar Vaishy | 62 |

aman19 | 58 |

Kumar Gaurav Singh | 58 |

saumitra13325 | 612 |

ashujack | 551 |

lakshmi_pandey | 544 |

aman19 | 538 |

piyushmittal25 | 514 |

blackshadows | 5249 |

akhayrutdinov | 5111 |

Ibrahim Nash | 5087 |

Quandray | 4354 |

sanjay05 | 3668 |

Login to report an issue on this page.