#include <bits/stdc++.h>
using namespace std;
int main() {
  double w, h, w1 = 1, h1 = 1, w2, h2;
  cin >> h >> w;
  for (int x = 0; (1ll << x) <= h; x++) {
    h2 = (1 << x);
    w2 = ceil(h2 / 1.25 - 1e-9);
    if (w2 < floor(h2 / .8 + 1e-9) + 1e-9 && w2 < w + 1e-9) {
      w2 = min(w, floor(h2 / .8 + 1e-9));
      if (w2 * h2 > w1 * h1) {
        w1 = w2;
        h1 = h2;
      } else if (abs(w1 * h1 - w2 * h2) < 1e-9 && h2 > h1) {
        h1 = h2;
        w1 = w2;
      }
    }
  }
  for (int x = 0; (1ll << x) <= w; x++) {
    w2 = (1 << x);
    h2 = ceil(w2 * .8 - 1e-9);
    if (h2 < floor(w2 * 1.25 + 1e-9) + 1e-9 && h2 < h + 1e-9) {
      h2 = min(h, floor(w2 * 1.25 + 1e-9));
      if (w1 * h1 < w2 * h2) {
        w1 = w2;
        h1 = h2;
      } else if (abs(w1 * h1 - w2 * h2) < 1e-9 && h2 > h1) {
        h1 = h2;
        w1 = w2;
      }
    }
  }
  cout.precision(0);
  cout.flags(ios::fixed);
  cout << h1 << " " << w1 << endl;
  return 0;
}
