#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 15;
bool judge(long long h, long long w) {
  if (h * 4 <= w * 5 && h * 5 >= w * 4) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  long long h, w;
  cin >> h >> w;
  if (h * 4 > w * 5) h = 5 * w / 4;
  if (h * 5 < w * 4) w = 5 * h / 4;
  int oh = __builtin_popcount(h);
  int ow = __builtin_popcount(w);
  if (judge(h, w) && (oh == 1 || ow == 1))
    cout << h << ' ' << w << endl;
  else {
    long long nh = 1 << 63 - __builtin_clzll(h);
    long long nw = 1 << 63 - __builtin_clzll(w);
    long long l = nw * 4 / 5, r = h;
    while (l <= r) {
      long long mid = l + r >> 1;
      if (judge(mid, nw))
        l = mid + 1;
      else
        r = mid - 1;
    }
    long long nl = nh * 4 / 5, nr = w;
    while (nl <= nr) {
      long long mid = nl + nr >> 1;
      if (judge(nh, mid))
        nl = mid + 1;
      else
        nr = mid - 1;
    }
    if (nh * nr > r * nw)
      cout << nh << ' ' << nr << endl;
    else
      cout << r << ' ' << nw << endl;
  }
  return 0;
}
