#include <bits/stdc++.h>
using namespace std;
int w, h;
long long resw, resh;
void upd(long long curw, long long curh) {
  if (curh * curw < resh * resw) return;
  if (curh * curw > resh * resw) {
    resh = curh;
    resw = curw;
    return;
  }
  if (curh > resh) {
    resh = curh;
    resw = curw;
  }
}
int main() {
  cin >> h >> w;
  for (long long l = 1; l <= w; l *= 2) {
    long long curw = l;
    long long curh = (curw * 5) / 4;
    if (curh > h) curh = h;
    if ((curw * 4 + 4) / 5 <= curh && (curh * 4 + 4) / 5 <= curw) {
      upd(curw, curh);
    }
  }
  for (long long l = 1; l <= h; l *= 2) {
    long long curh = l;
    long long curw = (curh * 5) / 4;
    if (curw > w) curw = w;
    if ((curw * 4 + 4) / 5 <= curh && (curh * 4 + 4) / 5 <= curw) {
      upd(curw, curh);
    }
  }
  cout << resh << " " << resw;
  return 0;
};
