#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long first = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    first = first * 10 + ch - '0';
    ch = getchar();
  }
  return first * f;
}
template <class T>
inline void print(T first) {
  if (first < 0) putchar('-'), first = -first;
  register short a[20] = {}, sz = 0;
  while (first) a[sz++] = first % 10, first /= 10;
  if (sz == 0) putchar('0');
  for (long long i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const long long inf = 2147483647;
const long long llinf = 2e18;
const long long mod = 998244353;
const unsigned long long MAXMOD = (unsigned long long)mod * (mod - 1);
long long w, h;
long long first, second;
long long p[111];
int main() {
  w = read(), h = read();
  p[0] = 1;
  for (long long i = 1; i <= 30; i++) {
    p[i] = p[i - 1] * 2;
  }
  long long i = 30;
  for (; i >= 1; i--) {
    if (p[i] <= min(w, (long long)(h * 5 / 4))) break;
  }
  first = p[i];
  second = min(h, (long long)(first * 5 / 4));
  long long sz1 = first * second;
  long long xx = first, yy = second;
  i = 30;
  for (; i >= 1; i--) {
    if (p[i] <= min(h, (long long)(w * 5 / 4))) break;
  }
  second = p[i];
  first = min(w, (long long)(second * 5 / 4));
  long long sz2 = first * second;
  if (sz1 > sz2) {
    print(xx), putchar(' '), print(yy), putchar('\n');
  } else if (sz2 > sz1) {
    print(first), putchar(' '), print(second), putchar('\n');
  } else if (first > xx) {
    print(first), putchar(' '), print(second), putchar('\n');
  } else
    print(xx), putchar(' '), print(yy), putchar('\n');
  return 0;
}
