#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e8;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
int main() {
  ios::sync_with_stdio(false);
  long long h, w;
  cin >> h >> w;
  vector<int> vh;
  vector<int> vw;
  long long num = 1;
  while (num <= h) vh.push_back(num), num *= 2;
  num = 1;
  while (num <= w) vw.push_back(num), num *= 2;
  reverse(((vh).begin()), ((vh).end()));
  reverse(((vw).begin()), ((vw).end()));
  long long maxi = 0, maxh = 0, maxw;
  for (int i = 0; i < ((int)((vh).size())); ++i) {
    long long hh = vh[i];
    double mwd = hh / 1.25 + EPS;
    if (mwd > w) continue;
    long long mw = hh / 0.8 + EPS;
    if (mw > w) mw = w;
    if (hh * mw > maxi || (hh * mw == maxi && hh > maxh))
      maxi = hh * mw, maxh = hh, maxw = mw;
  }
  for (int i = 0; i < ((int)((vw).size())); ++i) {
    long long ww = vw[i];
    double mhd = ww * 0.8 + EPS;
    if (mhd > h) continue;
    long long mh = ww * 1.25 + EPS;
    if (mh > h) mh = h;
    if (ww * mh > maxi || (ww * mh == maxi && mh > maxh))
      maxi = ww * mh, maxh = mh, maxw = ww;
  }
  cout << maxh << " " << maxw << endl;
  return 0;
}
