#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w;
  scanf("%d %d", &h, &w);
  long long mxW = 0, mxH = 0;
  for (long long hh = 1; hh <= h; hh <<= 1) {
    long long ww = min((long long)w, (hh * 5) >> 2);
    if (ww * 5 < hh * 4) continue;
    if (ww * hh > mxW * mxH || (ww * hh == mxW * mxH && hh > mxH)) {
      mxH = hh;
      mxW = ww;
    }
  }
  for (long long ww = 1; ww <= w; ww <<= 1) {
    long long hh = min((long long)h, (ww * 5) >> 2);
    if (hh * 5 < ww * 4) continue;
    if (ww * hh > mxW * mxH || (ww * hh == mxW * mxH && hh > mxH)) {
      mxH = hh;
      mxW = ww;
    }
  }
  printf("%I64d %I64d\n", mxH, mxW);
  return 0;
}
