#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
map<string, int> m;
set<string> s1[1501];
int max_size = -1000000007;
void DJ() {
  int ho, wo, h, w, h1, w1, h2, w2, o = 0;
  cin >> ho >> wo;
  int x = 1;
  while (x <= wo) {
    if (x * 1.25 <= ho) {
      h = floor(1.25 * x);
    } else if (x * 0.8 <= ho)
      h = ho;
    else
      break;
    x *= 2;
  }
  h1 = h;
  w1 = x / 2;
  x = 1;
  while (x <= ho) {
    if (x * 1.25 <= wo)
      w = floor(x * 1.25);
    else if (x * 0.8 <= wo)
      w = wo;
    else
      break;
    x *= 2;
  }
  h2 = x / 2;
  w2 = w;
  if ((long long)h1 * w1 > (long long)h2 * w2) {
    cout << h1 << " " << w1;
  } else if ((long long)h1 * w1 < (long long)h2 * w2) {
    cout << h2 << " " << w2;
  } else {
    if (h1 > h2)
      cout << h1 << " " << w1;
    else
      cout << h2 << " " << w2;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) DJ();
  return 0;
}
