#include <bits/stdc++.h>
using namespace std;
double w, h, tw, th, resw, resh;
int main() {
  cin >> w >> h;
  for (th = 1; th <= h; th *= 2) {
    tw = min(int(1.25 * th), int(w));
    if (tw / th >= 0.8 && tw * th > resw * resh) {
      resw = tw;
      resh = th;
    }
  }
  for (tw = 1; tw <= w; tw *= 2) {
    th = min(int(1.25 * tw), int(h));
    if (th / tw >= 0.8 && tw * th > resw * resh) {
      resw = tw;
      resh = th;
    }
  }
  cout << int(resw) << ' ' << int(resh);
}
