We have Infinitely Many Choclates and infinitely many children . And, We want to give them to children, But we will not give More than 'N' choclates to any one child. And, we want to give 'N' choclates to exactly 1 child.

And, We want to give thechoclates to as many children possible, in a beautiful sequence only.

**A beautiful sequence is an increasing sequence, in which a term A _{i} divides all A_{j}, where j>i. **

Forexample: 3, 6, 24 is a beautiful sequence of length 3.

- 3 divides 6 and 24
- 6 divides 24

We would give

- A
_{0}choclates to the first child, - A
_{1}choclates to the second child - ...and so on

We want maximum Children to get thechoclates. Output the Beautiful Sequence of maximum length.

**Input**

The first line contains T, the total number ofTestcases. Then Each of the next T lines, contains an integer denoting -'N'.

For each testcase, Print the beautiful sequence of

**1**≤**T**≤ 1000**1**≤**N**≤ 1000000

10

4

24

3

1 5 10

1 2 4

1 3 6 12 24

1 3

In the first case,N=10, 1 divides 5 and 10 5 divides 10. We can't give more than 10 choclates to any child, So We have to stop And this is the max. length achievable i.e.3.

Note that 1 2 10 is also a beautiful sequence of length 3, but we will choose that sequence containing more no. of choclates.i,e. 1 5 10

In the Third case,N=24 1 divides 3,6,12 and 24 3 divides 6,12, and 24. 6 divides 12 and 24 12 divides 24 We can't give more than 24 choclates to any child, So We have to stop and this is the max. length achievable i.e.5

In the Fourth Case , N=3 1 divides 3 . So We have to stop And this is the max. length achievable i.e. 2choclates, 3 is divisible by 1.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

ShubhamJain18 | 205 |

makeitdonesolo | 140 |

lost_found | 124 |

maggiiiii | 118 |

SahatPrasad1 | 108 |

Bishnu Dev Panda | 777 |

okayboss | 551 |

ShubhamJain18 | 516 |

yk12 | 514 |

makeitdonesolo | 480 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.