There are so many Houses in Sardapally. Every house has one unique number. But the only path to/from these houses is as described below
1)you can go directly only to house number 1 but not to others.
2)for other houses you have to go through other houses.
a) If house number m is even u have to go through the house number m/2.
b) If house number m is odd u have to go through the house number (m-1)/2.
Now, As we know Teju and Akash are best friends. They want to go for a Movie.You need to tell the common path they will follow while coming out from their houses ,while crossing sardapally.House number of Teju and Akash is given.
First line contains T, the number of test cases and N ,Total number of houses.Each test case contain one line of two integer x,y (house number of Teju and Akash respectively ).
For each test case, there will be one single line containing
all common house numbers, that Teju and Akash will follow, while crossing Sardapally.
Input: 2 100 32 64 34 14 Output: 1 2 4 8 16 32 1
For second test case: Path for house number 34 will be :34->17->8->4->2->1
and for house number 14 it will be : 14->7->3->1
so common path while crossing Sardapally is house number 1.
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions