#include <bits/stdc++.h>
using namespace std;
void solve(long long h, long long w) {
  long long resX = 1, resY = 1;
  for (long long x = 1; x <= h; x *= 2) {
    long long y = min(w, (x * 5) / 4);
    if (5 * y >= 4 * x) {
      if (x * y > resX * resY) {
        resX = x;
        resY = y;
      } else if (x * y == resX * resY && x > resX) {
        resX = x;
        resY = y;
      }
    }
  }
  for (long long y = 1; y <= w; y *= 2) {
    long long x = min(h, (y * 5) / 4);
    if (5 * x >= 4 * y) {
      if (x * y > resX * resY) {
        resX = x;
        resY = y;
      } else if (x * y == resX * resY && x > resX) {
        resX = x;
        resY = y;
      }
    }
  }
  cout << resX << ' ' << resY;
}
int main() {
  long long h, w;
  cin >> h >> w;
  solve(h, w);
  return 0;
}
