#include <bits/stdc++.h>
using namespace std;
void solve() {
  int w, h;
  cin >> w >> h;
  pair<long long, long long> mn;
  for (long long i = 1; i <= w; i = i << 1) {
    long long ww = i;
    long long hh = min(h, (int)(i * 1.25));
    if (hh < 0.8 * i) break;
    if (ww * hh > mn.first * mn.second ||
        (ww * hh == mn.first * mn.second && ww > mn.first)) {
      mn = pair<long long, long long>(ww, hh);
    }
  }
  for (long long i = 1; i <= h; i = i << 1) {
    long long hh = i;
    long long ww = min(w, (int)(i * 1.25));
    if (ww < 0.8 * i) break;
    if (ww * hh > mn.first * mn.second ||
        (ww * hh == mn.first * mn.second && ww > mn.first)) {
      mn = pair<long long, long long>(ww, hh);
    }
  }
  cout << mn.first << ' ' << mn.second;
}
int main() {
  solve();
  return 0;
}
