Limits 1s, 512 MB

Given a non-negative integers N. You have to find an integer P such that, the following conditions should be fulfilled.

1. P must be a divisor of N.
2. If we represent P as a binary number, then the LSB (least significant bit) of P must be 1.
3. P should be as large as possible.

Input

Input starts with an integer T (1 <= T <= 5000) denoting the number of test cases. Each test case contains an integer N (1 <= N <= 1012).

Output

For each test case print the case number and P.

Sample

InputOutput
3
2
14
11
Case 1: 1
Case 2: 7
Case 3: 11

This problem was authored for CodeMask Championship 2016 and is being hosted on Toph per organizer’s request.

Submit

Login to submit.

Statistics

75% Solution Ratio
ShadabEarliest, Apr '16
JIANEEFastest, 0.0s
JIANEELightest, 5.5 kB
bokaifShortest, 82B
Toph uses cookies. By continuing you agree to our Cookie Policy.