#include <bits/stdc++.h>
using namespace std;
void calc(uint64_t h, uint64_t w, uint64_t& hmax, uint64_t& wmax,
          uint64_t& areamax) {
  uint64_t temp = h * w;
  if (temp > areamax) {
    areamax = temp;
    hmax = h;
    wmax = w;
  } else if (temp == areamax) {
    if (h > hmax) {
      hmax = h;
      wmax = w;
    }
  }
}
int main() {
  uint64_t hi, wi;
  cin >> hi >> wi;
  vector<int> hv, wv;
  uint64_t val = 1;
  while (val <= hi) {
    hv.push_back(val);
    val *= 2;
  }
  val = 1;
  while (val <= wi) {
    wv.push_back(val);
    val *= 2;
  }
  uint64_t areamax = 0, hmax = 0, wmax;
  for (const auto& h : hv) {
    uint64_t w1 = ceil(((double)(h)*4) / 5);
    uint64_t w2 = floor(((double)(h)*5) / 4);
    uint64_t w = 0;
    if (wi >= w1) {
      w = min(wi, w2);
      calc(h, w, hmax, wmax, areamax);
    }
  }
  for (const auto& w : wv) {
    uint64_t h1 = ceil(((double)(w)*4) / 5);
    uint64_t h2 = floor(((double)(w)*5) / 4);
    uint64_t h = 0;
    if (hi >= h1) {
      h = min(hi, h2);
      calc(h, w, hmax, wmax, areamax);
    }
  }
  cout << hmax << " " << wmax << endl;
  return 0;
}
