n = int(eval(input()))

ans = 1

while ans*2 <= n:

  ans *= 2

print(ans)
N = int(eval(input()))

ans = 1

max_count = 0

n = 2

while (n <= N):

  k = n

  count = 0

  while k%2 == 0:

    k /= 2

    count += 1

  if count > max_count:

    ans = n

    max_count = count

  n += 1

print(ans)

n = int(eval(input()))
ans = 1
while ans * 2 <= n:
    ans *= 2
print(ans)

N = int(eval(input()))
ans = 1
max_count = 0
n = 2
while n <= N:
    k = n
    count = 0
    while k % 2 == 0:
        k /= 2
        count += 1
    if count > max_count:
        ans = n
        max_count = count
    n += 1
print(ans)

-n = int(eval(input())) +N = int(eval(input())) -while ans * 2 <= n: -    ans *= 2 +max_count = 0 +n = 2 +while n <= N: +    k = n +    count = 0 +    while k % 2 == 0: +        k /= 2 +        count += 1 +    if count > max_count: +        ans = n +        max_count = count +    n += 1