#include <bits/stdc++.h>
using namespace std;
long long w, h, cur = 2147483648;
bool f(string s) {
  string a, b;
  a.substr(0, s.size() / 2);
  b.substr(s.size() / 2, s.size() / 2);
  if (a == b) {
    return 1;
  } else
    return 0;
}
int main() {
  cin >> h >> w;
  double wid = min(h, w);
  while (wid < cur) {
    cur *= 0.5;
  }
  wid = cur;
  double hei = wid;
  int mx = max(h, w);
  while (((hei + 1) / wid) <= 1.25 && ((hei + 1) <= mx)) {
    hei++;
  }
  if (wid > w || hei > h) {
    int ad = wid;
    wid = hei;
    hei = ad;
  }
  cout << (int)hei << " " << (int)wid;
  return 0;
}
