#include <bits/stdc++.h>
using namespace std;
int main() {
  long long h, w;
  cin >> h >> w;
  long long area = 0, hh = 0, ww = 0;
  for (long long i = 1; i <= h; i <<= 1) {
    for (int v = 16; v <= 25; v += 25 - 16) {
      long long j = min(w, 20 * i / v);
      if (16 * j <= 20 * i && 20 * i <= 25 * j) {
        if (i * j > area) {
          area = i * j;
          hh = i;
          ww = j;
        }
      }
    }
  }
  for (long long j = 1; j <= w; j <<= 1) {
    for (int v = 16; v <= 25; v += 25 - 16) {
      long long i = min(h, v * j / 20);
      if (16 * j <= 20 * i && 20 * i <= 25 * j) {
        if (i * j > area || (i * j == area && i > hh)) {
          area = i * j;
          hh = i;
          ww = j;
        }
      }
    }
  }
  cout << hh << " " << ww << endl;
  return 0;
}
