Odd Game
Easy Accuracy: 40.52% Submissions: 1257 Points: 2

It was a very boring day, so a geek thought to play a game with his friends. To make the day interseting he started playing game. The game was very simple, he intitialised number to all his friends and made them stand in increasing order. eg. 1,2,3,4,5...... 
Now he eleminates the players at odd places and few are left. 2,4...
Again he eleminates the players at odd places and he do this util only one of his friend is left in this game. 4... And the only player left wins.
Now the task geek assigned you was that you have to find which of his friend will win.

Input:
First line contains the number of test cases t. The next t lines contain integer n, the number of players playing this game.

Output:
Display t lines, each containg a single integer, denoting the player which will win.

Constraints:
1 <= T <= 1000
1 <= N <= 109

Example:
Input:

2
5
12

Output:
4
8

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.