#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795029L;
bool solve(int testNumber) {
  long long h, w;
  if (scanf("%lld %lld", &h, &w) == EOF) return false;
  long long H = 0, W = 0;
  for (long long i = 1; i <= h; i *= 2) {
    long long from = (4 * i + 4) / 5, to = min(5 * i / 4, w);
    if (to >= from and (i * to > H * W or (i * to == H * W and i > H))) {
      H = i;
      W = to;
    }
  }
  for (long long i = 1; i <= w; i *= 2) {
    long long from = (4 * i + 4) / 5, to = min(5 * i / 4, h);
    if (to >= from and (i * to > H * W or (i * to == H * W and to > H))) {
      W = i;
      H = to;
    }
  }
  printf("%lld %lld\n", H, W);
  return true;
}
int main() {
  for (int i = 1; solve(i); i++)
    ;
  return 0;
}
