public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a, b, min = Integer.MAX_VALUE, anotherMin = Integer.MAX_VALUE;

        while (scanner.hasNextInt()) {
            a = scanner.nextInt();
            min = a < min ? a : min;
            if (scanner.hasNextInt()) {
                b = scanner.nextInt();
                anotherMin = b < anotherMin ? b : anotherMin;
            }
        }
        scanner.close();
        min = anotherMin < min ? min : anotherMin;
        System.out.println(min);
    }
}