#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int sum, suf, pre, max;
} Node;
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
const int MAXN = 2e5 + 100;
const int UP = 31;
const long long int highest = 1e18;
const double pi = acos(-1);
const double Phi = 1.618033988749894;
const int logn = 20;
const double root5 = 2.236067977;
const long long int inf64 = 1e16;
const int ini = -1e9;
long long int h, w, hh = 1, ww, ans = 0, rh, rw;
int main() {
  cin >> h >> w;
  while (hh <= h) {
    ww = min(hh * 5 / 4, w);
    if (ww >= ceil(hh * 4.0 / 5) && hh * ww >= ans)
      ans = ww * hh, rh = hh, rw = ww;
    hh *= 2;
  }
  ww = 1;
  while (ww <= w) {
    hh = min(ww * 5 / 4, h);
    if (hh >= ceil(ww * 4.0 / 5) && ww * hh >= ans) {
      if (hh * ww == ans && hh > rh) rh = hh, rw = ww;
      if (ww * hh > ans) ans = ww * hh, rh = hh, rw = ww;
    }
    ww *= 2;
  }
  cout << rh << " " << rw << "\n";
  return 0;
}
