#include <bits/stdc++.h>
using namespace std;
long long A, B, H, W;
long long getNext(long long x) {
  long long k = 1;
  while (k <= x) k *= 2;
  return k;
}
long long getPrevious(long long x) {
  long long k = 1;
  while (k * 2ll <= x) k *= 2;
  return k;
}
int main() {
  long long ret1 = 0, ret2 = 0, area = 0;
  scanf("%I64d %I64d", &A, &B);
  H = A, W = B;
  if (A < B) swap(A, B);
  long long n = getNext(B);
  long long m = B;
  if (n <= A && n * 4 <= m * 5) {
    ret1 = n;
    ret2 = m;
    area = n * m;
  }
  n = getPrevious(B);
  m = min(n * 5 / 4, A);
  if (n < m) swap(n, m);
  if (area < n * m) ret1 = n, ret2 = m;
  if (ret1 > H || ret2 > W) swap(ret1, ret2);
  printf("%I64d %I64d\n", ret1, ret2);
}
