#include <bits/stdc++.h>
using namespace std;
long long int i, j, k, l, m, h, w, x, y, maxx, maxy, p;
int main() {
  {
    cin >> h >> w;
    maxx = 1;
    maxy = 1;
    double q;
    long long int step = 1, pp = 0;
    for (i = 1; i < 1000; i++) {
      step *= 2;
      if (step <= w) {
        pp = int(1.25 * step);
        if (pp <= h) {
          if (maxx * maxy == step * pp && maxy < pp) {
            {
              maxx = step;
              maxy = pp;
            }
          }
          if (maxx * maxy < step * pp) {
            maxx = step;
            maxy = pp;
          }
        } else {
          q = double(step) / double(h);
          if ((q - 0.8) > 0.000000001 && (q) < 1.25000001) {
            if (maxx * maxy == step * h && maxy < h) {
              {
                maxx = step;
                maxy = h;
              }
            }
            if (maxx * maxy < step * h) {
              maxx = step;
              maxy = h;
            }
          }
        }
      }
      if (step <= h) {
        pp = int(1.25 * step);
        if (pp <= w) {
          if (maxx * maxy == step * pp && maxy < step) {
            {
              maxx = pp;
              maxy = step;
            }
          }
          if (maxx * maxy < step * pp) {
            maxx = pp;
            maxy = step;
          }
        } else {
          q = double(step) / double(w);
          p = double(w) / double(step);
          if ((q - 0.8) > 0.000001 && (q) < 1.25000001) {
            if (maxx * maxy == step * w && maxy < step) {
              {
                maxx = w;
                maxy = step;
              }
            }
            if (maxx * maxy < step * w) {
              maxx = w;
              maxy = step;
            }
          }
        }
      }
    }
    cout << maxy << " " << maxx << endl;
  }
  return 0;
}
