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.

bruceewayne | 193 |

manvirag982 | 182 |

Core_Ka_Bachha | 180 |

shivam123ahuja | 175 |

Sanjana Singh 1 | 173 |

mr_kksparrow | 433 |

manvirag982 | 398 |

TheHandle | 291 |

rajupraaa1234 | 276 |

Exception_404 | 268 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.