#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long h, w, nh, nw, maxs = 1, ansh = 1, answ = 1, kansh = 1, kansw = 1,
                          kmaxs = 1;
  scanf("%I64d %I64d", &h, &w);
  nh = 1;
  nw = 1;
  while ((nh <= h) && (nh * 5 <= w * 4)) nh *= 2;
  if (nh > h) {
    ansh = nh / 2;
    answ = nh * 5;
    answ /= 8;
    maxs = ansh * answ;
  } else {
    nw = nh * 4;
    answ = max(w, nw / 5);
    if (answ > w) {
      nh /= 2;
      ansh = nh;
      answ = nh * 5;
      answ /= 4;
      maxs = ansh * answ;
    } else {
      ansh = nh;
      maxs = ansh * answ;
    }
  }
  nw = 1;
  nh = 1;
  while ((nw <= w) && (nw * 5 <= h * 4)) nw *= 2;
  if ((nw > w)) {
    nw /= 2;
    kansw = nw;
    kansh = nw * 5;
    kansh /= 4;
    kmaxs = kansh * kansw;
  } else {
    nh = nw * 4;
    kansh = max(h, nh / 5);
    if (kansh > h) {
      nw /= 2;
      kansw = nw;
      kansh = nw * 5;
      kansh /= 4;
      kmaxs = kansh * kansw;
    } else {
      kansw = nw;
      kmaxs = kansh * kansw;
    }
  }
  if (kmaxs > maxs) {
    ansh = kansh;
    answ = kansw;
  }
  if ((kmaxs == maxs) && (kansh > ansh)) {
    ansh = kansh;
    answ = kansw;
  }
  printf("%I64d %I64d", ansh, answ);
  return 0;
}
