#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
long long bw, bh;
void check(long long nw, long long nh) {
  if (nw * nh > bw * bh || nw * nh == bw * bh && nw > bw) {
    bw = nw;
    bh = nh;
  }
}
int main() {
  long long w, h;
  cin >> w >> h;
  for (long long d = 1; d <= max(w, h); d *= 2) {
    if (d <= w) {
      if (d * 4 <= 5 * h) check(d, min((long long)(d * 1.25 + .1), h));
    }
    if (d <= h) {
      if (d * 4 <= 5 * w) check(min((long long)(d * 1.25 + .1), w), d);
    }
  }
  cout << bw << ' ' << bh << endl;
  return 0;
}
