#include <bits/stdc++.h>
int main() {
  int h, w, bh, bw, th, tw;
  long long ar, ba;
  bh = bw = ba = 0;
  scanf("%d %d", &h, &w);
  int tmp;
  for (int i = 30; i >= 0; i--) {
    tmp = (1 << i);
    if (tmp <= w) {
      long long x = (long long)tmp * 8;
      long long y = (long long)tmp * 125;
      if (x % 10 != 0)
        x = x / 10 + 1;
      else
        x = x / 10;
      y /= 100;
      if (y <= h) {
        th = y;
        tw = tmp;
        ar = (long long)th * (long long)tw;
        if (ar > ba || ar == ba && th > bh) {
          bh = th;
          bw = tw;
          ba = (long long)bh * (long long)bw;
        }
      } else if (x <= h) {
        th = h;
        tw = tmp;
        ar = (long long)th * (long long)tw;
        if (ar > ba || ar == ba && th > bh) {
          bh = th;
          bw = tw;
          ba = (long long)bh * (long long)bw;
        }
      }
    }
  }
  for (int i = 30; i >= 0; i--) {
    tmp = (1 << i);
    if (tmp <= h) {
      int x = (int)((double)tmp / 1.25);
      int y = (int)((double)tmp / 0.8);
      if ((double)y * 0.8 < (double)tmp) y++;
      if ((double)x * 1.25 > (double)tmp) x--;
      if (y <= w) {
        th = tmp;
        tw = y;
        ar = (long long)th * (long long)tw;
        if (ar > ba || ar == ba && th > bh) {
          bh = th;
          bw = tw;
          ba = (long long)bh * (long long)bw;
        }
      } else if (x < w) {
        th = tmp;
        tw = w;
        ar = (long long)th * (long long)tw;
        if (ar > ba || ar == ba && th > bh) {
          bh = th;
          bw = tw;
          ba = (long long)bh * (long long)bw;
        }
      }
    }
  }
  if (bw > bh && bw <= h) std::swap(bw, bh);
  printf("%d %d\n", bh, bw);
  return 0;
}
