#include <bits/stdc++.h>
using namespace std;
int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();
struct Cut {
  int64_t h, w;
  bool operator<(Cut other) const {
    return make_tuple(h * w, h) < make_tuple(other.h * other.w, other.h);
  }
};
int main() {
  int h, w;
  cin >> h >> w;
  Cut ans{};
  for (int64_t d = 1; d <= h; d *= 2) {
    Cut c{d, min<int64_t>(d * 5 / 4, w)};
    if (5 * c.w >= 4 * c.h && ans < c) ans = c;
  }
  for (int64_t d = 1; d <= w; d *= 2) {
    Cut c{min<int64_t>(d * 5 / 4, h), d};
    if (5 * c.h >= 4 * c.w && ans < c) ans = c;
  }
  cout << ans.h << ' ' << ans.w << endl;
  return 0;
}
