#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, -1, 0};
int dy[] = {1, 0, 0, -1};
long long pw(long long b, long long p) {
  if (!p) return 1;
  long long sq = pw(b, p / 2);
  sq *= sq;
  if (p % 2) sq *= b;
  return sq;
}
const int N = 302, M = (N << 1);
double H, W, h, w, hh, ww;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> W >> H;
  for (hh = 1; hh <= H; hh *= 2) {
    ww = min(int(1.25 * hh), int(W));
    if (ww / hh >= 0.8 && ww * hh > w * h) {
      w = ww;
      h = hh;
    }
  }
  for (ww = 1; ww <= W; ww *= 2) {
    hh = min(int(1.25 * ww), int(H));
    if (hh / ww >= 0.8 && ww * hh > w * h) {
      w = ww;
      h = hh;
    }
  }
  cout << (int)w << " " << (int)h;
  return 0;
}
