Given a number **N**, print all the numbers which are a bitwise subset of the binary representation of N. Bitwise subset of a number **N** will be the numbers **i** in the range **0<=i<=N** which satisfy the below condition:

**N & i == i**

**Input:**

The first line of input contains an integer **T ** denoting the number of test cases. For each test case, there is an integer **N **denoting the number.

**Output:**

For each test case, the output is the space separated integers that satisfy the above condition.

**Constraints:**

1<=T<=100

1<=N<=10000

**Example:
Input**

2

5

9

5 4 1 0

9 8 1 0

**Explanation:
For 1st test case:
**0 & 5 = 0

1 & 5 = 1

2 & 5 = 0

3 & 5 = 1

4 & 5 = 4

5 & 5 = 5

Author: Vanshika_pec

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.

ramabhatta | 35 |

Shubham Awasthi | 34 |

pguptacse17 | 30 |

abhithakur588 | 28 |

adityasuman2025 | 27 |

the_coder95 | 1236 |

RishabhTanwar1 | 1104 |

thanuvinu94 | 676 |

tathagat289 | 664 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4889 |

Quandray | 4547 |

Login to report an issue on this page.