#include <bits/stdc++.h>
using namespace std;
int h, w;
long long best_h, best_w;
long double ep = 0.0000000001;
int main() {
  cin >> h >> w;
  long long l, r, re;
  int i;
  for (i = 1; i <= h; i *= 2) {
    l = 0;
    r = w + 1;
    while (r - l > 1) {
      re = ((l + r) >> 1);
      if ((long double)i / (long double)re < 0.8 - ep)
        r = re;
      else
        l = re;
    }
    if ((long double)i / (long double)l < 1.25 + ep &&
        i * l >= best_h * best_w) {
      best_h = i;
      best_w = l;
    }
  }
  for (i = 1; i <= w; i *= 2) {
    l = 0;
    r = h + 1;
    while (r - l > 1) {
      re = ((l + r) >> 1);
      if ((long double)re / (long double)i > 1.25 + ep)
        r = re;
      else
        l = re;
    }
    if ((long double)l / (long double)i > 0.8 - ep) {
      if (i * l > best_h * best_w) {
        best_h = l;
        best_w = i;
      } else if (i * l == best_h * best_w && l > best_h) {
        best_h = l;
        best_w = i;
      }
    }
  }
  cout << best_h << " " << best_w << endl;
  return 0;
}
