#include <bits/stdc++.h>
using namespace std;
long long hmax = 0, wmax = 0;
void case1(long long h, long long w) {
  long long hnew = 1;
  while (hnew <= h) hnew *= 2;
  hnew /= 2;
  double w1 = hnew * 0.8, w2 = hnew * 1.25;
  if (w < w1) return;
  if (w > w2) w = w2;
  if (hmax * wmax < hnew * w) {
    hmax = hnew;
    wmax = w;
  } else if (hmax * wmax == hnew * w && hmax < hnew) {
    hmax = hnew;
    wmax = w;
  }
  return;
}
void case2(long long h, long long w) {
  long long wnew = 1;
  while (wnew <= w) wnew *= 2;
  wnew /= 2;
  double h1 = wnew * 0.8, h2 = wnew * 1.25;
  if (h < h1) return;
  if (h > h2) h = h2;
  if (hmax * wmax < wnew * h) {
    hmax = h;
    wmax = wnew;
  } else if (hmax * wmax == wnew * h && hmax < h) {
    hmax = h;
    wmax = wnew;
  }
  return;
}
int main() {
  long long h, w;
  cin >> h >> w;
  case1(h, w);
  case2(h, w);
  cout << hmax << " " << wmax << endl;
}
