#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> solve(long long a, long long b) {
  vector<long long> val;
  for (long long i = 2; i <= 2; i++) {
    long long cur = 1;
    while (cur <= a) {
      val.push_back(cur);
      cur = cur * 2;
    }
  }
  long long other = -1;
  long long ca = 1;
  for (long long i = val.size() - 1; i >= 0; i--) {
    long long mi = val[i];
    long long l = mi * 4 / 5 + (mi * 4 % 5 && 1);
    long long r = mi * 5 / 4;
    if (b < l) continue;
    long long choose = min(b, r);
    if (choose > other) {
      other = choose;
      ca = mi;
    }
  }
  return make_pair(ca, other);
}
long long area(pair<long long, long long> hcn) {
  return hcn.first * hcn.second;
}
int main() {
  long long w, h;
  cin >> w >> h;
  pair<long long, long long> u1 = solve(w, h);
  pair<long long, long long> u2 = solve(h, w);
  if (area(u1) > area(u2)) {
    cout << u1.first << " " << u1.second;
  } else {
    cout << u2.second << " " << u2.first << endl;
  }
}
