#include <bits/stdc++.h>
using namespace std;
long long res, mx, r1, r2;
int main() {
  long long h, w, p, q;
  cin >> h >> w;
  p = 1;
  while (p <= h) {
    if (p > h) break;
    q = (long long)(p / 4.0 * 5.0);
    if (q > w) q = w;
    if ((long long)(q / 4.0 * 5.0) < p) break;
    if (p * q > mx) {
      mx = p * q;
      r1 = p;
      r2 = q;
    }
    p *= 2;
  }
  q = 1;
  while (q <= w) {
    if (q > w) break;
    p = (long long)(q / 4.0 * 5.0);
    if (p > h) p = h;
    if ((long long)(p / 4.0 * 5.0) < q) break;
    if (p * q > mx) {
      mx = p * q;
      r1 = p;
      r2 = q;
    }
    q *= 2;
  }
  if (r1 <= w && r2 <= h) {
    if (r1 < r2) {
      int temp = r1;
      r1 = r2;
      r2 = temp;
    }
  }
  cout << r1 << " " << r2 << endl;
  return 0;
}
