#include <bits/stdc++.h>
using namespace std;
long long W, H;
long long bh = 0, bw = 0;
int main() {
  cin >> H >> W;
  for (long long w = 1; w <= W; w *= 2) {
    long long h = min((5 * w) / 4, H);
    if ((4 * h <= 5 * w) && (4 * w <= 5 * h)) {
      if (w * h > bw * bh) {
        bw = w;
        bh = h;
      } else if (w * h == bw * bh) {
        if (h > bh) {
          bh = h;
          bw = w;
        }
      }
    }
  }
  for (long long h = 1; h <= H; h *= 2) {
    long long w = min(W, (5 * h) / 4);
    if ((4 * h <= 5 * w) && (4 * w <= 5 * h)) {
      if (w * h > bw * bh) {
        bw = w;
        bh = h;
      } else if (w * h == bw * bh) {
        if (h > bh) {
          bh = h;
          bw = w;
        }
      }
    }
  }
  cout << bh << " " << bw;
  return 0;
}
