#include <bits/stdc++.h>
using namespace std;
long long h, w;
long long resh, resw, s;
long long hh, ww;
void pending(long long x, long long y) {
  if (x * y > s || x * y == s && x > resh) {
    s = x * y;
    resh = x, resw = y;
  }
}
int main() {
  long long i, j;
  long long lb, ub;
  while (cin >> h >> w) {
    resh = -1, resw = -1;
    s = -1;
    for (i = 1; i <= h; i *= 2) {
      lb = (i * 4 + 4) / 5;
      ub = i * 5 / 4;
      j = ub;
      if (w < ub) j = w;
      if (w < lb) break;
      pending(i, j);
    }
    for (i = 1; i <= w; i *= 2) {
      lb = (i * 4 + 4) / 5;
      ub = i * 5 / 4;
      j = ub;
      if (h < ub) j = h;
      if (h < lb) break;
      pending(j, i);
    }
    cout << resh << " " << resw << endl;
  }
  return 0;
}
