#include <bits/stdc++.h>
using namespace std;
long long pow2[33];
long long cut(long long h, long long w) {
  bool ok = false;
  for (int i = (0); i < ((33)); ++i)
    if (pow2[i] == w) ok = true;
  if (4 * h > 5 * w) {
    if (!ok) {
      long long t = 1;
      while (2 * t <= h && 8 * t <= 5 * w) t *= 2;
      h = t;
    } else {
      h = 1.25 * w;
      while (4 * (h + 1) < 5 * w) h++;
    }
  }
  return h;
}
int main() {
  long long h, w;
  cin >> h >> w;
  pow2[0] = 1;
  for (int i = (1); i < (33); ++i) pow2[i] = pow2[i - 1] * 2;
  bool okh = false, okw = false;
  for (int i = (0); i < ((33)); ++i)
    if (pow2[i] == h) okh = true;
  for (int i = (0); i < ((33)); ++i)
    if (pow2[i] == w) okw = true;
  if (4 * h > 5 * w) {
    h = cut(h, w);
    cout << h << " " << w << endl;
  } else if (4 * w > 5 * h) {
    w = cut(w, h);
    cout << h << " " << w << endl;
  } else {
    if (!okh && !okw) {
      long long ww = 1;
      long long t = h;
      while (2 * ww <= w) ww *= 2;
      if (4 * h > 5 * ww) {
        t = cut(h, ww);
      }
      long long x = t * ww;
      long long hh = 1;
      long long s = w;
      while (2 * hh <= h) hh *= 2;
      if (4 * w > 5 * hh) {
        s = cut(w, hh);
      }
      long long y = hh * s;
      if (x >= y) {
        cout << t << " " << ww << endl;
      } else {
        cout << hh << " " << s << endl;
      }
    } else {
      cout << h << " " << w << endl;
    }
  }
  return 0;
}
