#include <bits/stdc++.h>
using namespace std;
int solve(int l, int r) {
  if (l == r) {
    return l;
  } else {
    return 2;
  }
}
void tests() {
  assert(solve(2, 2) == 2);
  assert(solve(3, 3) == 3);
  assert(solve(4, 4) == 4);
  assert(solve(7, 7) == 7);
  assert(solve(2, 3) == 2);
  assert(solve(3, 6) == 2);
  assert(solve(3, 4) == 2);
}
int main() {
  tests();
  int l, r;
  while (cin >> l >> r) {
    cout << solve(l, r) << endl;
  }
  return 0;
}
