252662256 252662260
 141650963 141650963
 4 12
 1002523 1002523
 93 95
 331900277 331900277
 56 92
 10 100
 3 1000000000
 13 13
 2 879190747
 999900001 1000000000
 820844234 892579936
 419873015 419873018
 568814539 568814539
 999999937 999999937
 519002744 519002744
 80270976 80270977
 5 10
 3 6
 392602363 392602367
 6 12
 634097178 634097179
 6 15
 3 10
 305693653 305693653
 2 3
 1200007 1200007
 5 100
 10000019 10000019
 720270740 720270743
 94 95
 908580370 968054552
 760632746 850720703
 900000011 900000011
 37622224 162971117
 5 5
 76 134
 3 12
 39 91
 999992977 999992977
 17 17
 29 29
 770439256 770439256
 347877978 913527175
 3 8
 5 15
 349533413 349533413
 100000007 100000007
 104729 104729
 900000000 1000000000
 479001599 479001599
 999727999 999727999
 1717 1717
 15 27
 100003 100003
 51 52
 17 35
 1000003 1000003
 6 8
 11 11
 741254764 741254768
 2 2
 30 37
 2 1000000000
 4 8
 620769961 988145114
 951594860 953554446
 450868287 450868290
 575062045 575062049
 28829775 28829776
 999999797 999999797
 990000023 990000023
 871232720 871232722
 242 244
 273072892 273072894
 2 999999999
 7 7
 38 98
 39916801 39916801
 998244353 998244353
 3 111111
 3 3
 982451653 982451653
 3 18
 47 52
 999999103 999999103
 999999929 999999929
 3 99
 715827883 715827883
 12 18
 999999733 999999733

2
 141650963
 2
 1002523
 2
 331900277
 2
 2
 2
 13
 2
 2
 2
 2
 568814539
 999999937
 519002744
 2
 2
 2
 2
 2
 2
 2
 2
 305693653
 2
 1200007
 2
 10000019
 2
 2
 2
 2
 900000011
 2
 5
 2
 2
 2
 999992977
 17
 29
 770439256
 2
 2
 2
 349533413
 100000007
 104729
 2
 479001599
 999727999
 1717
 2
 100003
 2
 2
 1000003
 2
 11
 2
 2
 2
 2
 2
 2
 2
 2
 2
 2
 999999797
 990000023
 2
 2
 2
 2
 7
 2
 39916801
 998244353
 2
 3
 982451653
 2
 2
 999999103
 999999929
 2
 715827883
 2
 999999733

import java.io.*;
import java.util.*;
import java.util.stream.Collectors;

public class Solution {
    public static void main(String[] args) throws IOException {
        IO io = new IO() ;
        int l = io.getInt(), r = io.getInt(), n = l - r + 1 ;
        if(l == r && l % 2 != 0) {
            System.out.println(l);
            return;
        }
        int ts = l % 2 == 0 ? l: l - l % 2 + 2, te = r - r % 2 ;
        int ths = l % 3 == 0 ? l: l - l % 3 + 3, the = r - r % 3 ;
        int n2 = (te - ts) / 2 + 1, n3 = (the - ths) / 3 + 1 ;

//        Utils.print(ts, te, ths, the) ;
        System.out.println(n2 > n3 ? 2: 3) ;
    }
}

class Utils {

    public static void swap(List<Integer> ls, int i, int j){
        int temp = ls.get(i) ;
        ls.set(i, ls.get(j)) ;
        ls.set(j, temp) ;
    }

    public static long gcd(long a, long b){
        if(a < b)
            return gcd(b, a) ;
        else if(a == b || b == 0)
            return a ;
        else{
            return gcd(b, a % b) ;
        }
    }

    public static long subSum(long[] pre, int l, int h){
        return l == 0 ? pre[h]: pre[h] - pre[l - 1] ;
    }

    public static class Pair implements Comparable<Pair>{
        public int m, s ;

        public Pair(int a, int b) {
            this.m = a;
            this.s = b;
        }

        @Override
        public int compareTo(Pair o) {
            return m - o.m ;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "m=" + m +
                    ", s=" + s +
                    '}';
        }
    }

    public static void ifPrint(boolean test, Object ifValue, Object elseValue){
        System.out.println(test ? ifValue: elseValue) ;
    }

    public static void print(Character delim, Object... a){
        List<String> top = new ArrayList<>() ;
        for(Object aa: a)
            top.add(aa == null ? "null": aa.toString()) ;
        System.out.println(join(top, delim.toString())) ;
    }

    public static void print(Object... a){
        print(' ', a) ;
    }

    public static  <T extends Comparable<T>> int lowerBound(T[] arr, int l, int h, T key){
        while(l < h){
            int mid = (l + h) / 2 ;
            if(arr[mid].compareTo(key) < 0)
                l = mid + 1 ;
            else
                h = mid ;
        }
        return arr[l].compareTo(key) >= 0 ? l: -1 ;
    }

    public static <T extends Comparable<T>> int upperBound(T[] arr, int l, int h, T key){
        while(l < h){
            int mid = (l + h) / 2 ;
            if(arr[mid].compareTo(key) < 0)
                l = mid + 1 ;
            else if(arr[mid].compareTo(key) == 0)
                l = mid ;
            else
                h = mid ;
            if(h == l + 1)
                break ;
        }
        return arr[l].compareTo(key) >= 0 ? l: -1 ;
    }

    public static class IndexedElement<T> {
        int idx;
        T val;

        public IndexedElement(int idx, T val) {
            this.idx = idx;
            this.val = val;
        }
    }

    public static <T> ArrayList<IndexedElement<T>> getIndexedArray(ArrayList<T> ip) {
        ArrayList<IndexedElement<T>> op = new ArrayList<>();
        for (int i = 0; i < ip.size(); i++) {
            op.add(new IndexedElement<>(i, ip.get(i)));
        }
        return op;
    }

    public static <T> String join(List<T> ls) {
        return join(ls, " ") ;
    }

    public static <T> String join(List<T> ls, String delim) {
        StringJoiner sj = new StringJoiner(delim);
        for (T a : ls)
            sj.add(a.toString());
        return sj.toString();
    }

    public static <T> void print2DArray(List<List<T>> mat) {
        for (List<T> m : mat) {
            System.out.println("{ " + join(m, ", ") + " }");
        }
    }

    public static  <T> void reverseArrray(T[] arr, int l, int h){
        while(l < h){
            T temp = arr[l] ;
            arr[l] = arr[h] ;
            arr[h] = temp ;
            l++ ;
            h-- ;
        }
    }
}

class IO {
    private BufferedReader br = null;
    private StringTokenizer st = null;

    public IO() {
        this(System.in);
    }

    public IO(InputStream is) {
        this.br = new BufferedReader(new InputStreamReader(is));
    }

    public List<String> getStringArray(int n) throws IOException {
        if (n == 0)
            return new ArrayList<>();
        if (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        List<String> res = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if (!st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            res.add(st.nextToken());
        }
        return res;
    }
    public String getString() throws IOException {
        List<String> res = this.getStringArray(1);
        return res.size() == 0 ? "" : res.get(0);
    }

    public List<Integer> getIntegerArray(int n) throws IOException {
        if (n == 0)
            return new ArrayList<>();
        List<String> res = getStringArray(n);
        return res.stream().map(Integer::parseInt).collect(Collectors.toList());
    }
    public Integer getInt() throws IOException {
        List<Integer> res = this.getIntegerArray(1);
        return res.size() == 0 ? 0 : res.get(0);
    }

    public List<Long> getLongArray(int n) throws IOException {
        if (n == 0)
            return new ArrayList<>();
        List<String> res = getStringArray(n);
        return res.stream().map(Long::parseLong).collect(Collectors.toList());
    }
    public Long getLong() throws IOException {
        List<Long> res = this.getLongArray(1);
        return res.size() == 0 ? 0L : res.get(0);
    }

    public List<Double> getDoubleArray(int n) throws IOException {
        if (n == 0)
            return new ArrayList<>();
        List<String> res = getStringArray(n);
        return res.stream().map(Double::parseDouble).collect(Collectors.toList());
    }
    public Double getDouble() throws IOException {
        List<Double> res = this.getDoubleArray(1);
        return res.size() == 0 ? 0.0 : res.get(0);
    }
}