#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string get() {
  char ch[1001000];
  scanf("%s", ch);
  return ch;
}
template <class P, class Q>
inline P smin(P &a, Q b) {
  if (b < a) a = b;
  return a;
}
template <class P, class Q>
inline P smax(P &a, Q b) {
  if (a < b) a = b;
  return a;
}
const long long maxn = 1000 + 10;
const long long base = 29;
const long long MAX_LG = 21;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const long long maxq = 2e5 + 10;
pair<long long, long long> vc;
long long best = 0;
int32_t main() {
  long long h = in(), w = in();
  vc = {0, 0};
  for (long long i = 1; i <= w; i *= 2) {
    long long j = i + i / 4;
    j = min(j, h);
    if (j < (double)i - i / 5.0) continue;
    if ((long long)i * j > best || ((long long)i * j == best && j > vc.first)) {
      best = (long long)i * j;
      vc = {j, i};
    }
  }
  for (long long i = 1; i <= h; i *= 2) {
    long long j = i + i / 4;
    j = min(j, w);
    if (j < (double)i - i / 5.0) continue;
    if ((long long)i * j > best || ((long long)i * j == best && i > vc.first)) {
      best = (long long)i * j;
      vc = {i, j};
    }
  }
  cout << vc.first << " " << vc.second << "\n";
}
