#include <bits/stdc++.h>
using namespace std;
pair<long long, int> find(int h, int w) {
  pair<long long, int> res = make_pair(-1, -1);
  for (int i = 1; i <= h; i *= 2) {
    if (5 * (long long)w < 4 * (long long)i) break;
    int len = (int)(1.25 * i);
    len = min(len, w);
    pair<long long, int> t = make_pair((long long)i * len, i);
    res = max(res, t);
  }
  for (int i = 1; i <= w; i *= 2) {
    if (5 * (long long)h < 4 * (long long)i) break;
    int len = (int)(1.25 * i);
    len = min(len, h);
    pair<long long, int> t = make_pair((long long)i * len, len);
    res = max(res, t);
  }
  return res;
}
int main() {
  int h, w;
  cin >> h >> w;
  pair<long long, int> ans = find(h, w);
  cout << ans.second << " " << ans.first / ans.second;
  return 0;
}
