#include <bits/stdc++.h>
using namespace std;
vector<long long> area(long long h, long long w) {
  long long p = log2(h);
  for (p; p >= 0; p--) {
    long long y = pow(2, p);
    long long a = ceil(y / 1.25), b = round(y / 0.8);
    if (w >= a && w <= b) {
      vector<long long> s = {y, w};
      return s;
    } else if (b < w) {
      vector<long long> s = {y, b};
      return s;
    }
  }
  vector<long long> s = {h, 0};
  return s;
}
int main() {
  long long h, w;
  cin >> h >> w;
  vector<long long> a = area(h, w), b = area(w, h);
  if (a[0] * a[1] > b[0] * b[1]) {
    cout << a[0] << " " << a[1] << endl;
  } else if (a[0] * a[1] < b[0] * b[1]) {
    cout << b[1] << " " << b[0] << endl;
  } else {
    if (a[0] > b[1])
      cout << a[0] << " " << a[1] << endl;
    else
      cout << b[1] << " " << b[0] << endl;
  }
  return 0;
}
