import java.util.*;


public class Solution {
    
    public class ComparaActivities implements Comparator<ArrayList<Integer>> {
        @Override
        public int compare(ArrayList<Integer> activity1, ArrayList<Integer> activity2) {
            if (activity1.get(0) < activity2.get(0)) {
                return -1;
            } else if (activity1.get(0) > activity2.get(0)) {
                return 1;
            } else {
                if (activity1.get(1) < activity2.get(1)) {
                    return -1;
                } else if (activity1.get(1) > activity2.get(1)) {
                    return 1;
                } else {
                    return 0;
                }
            }
        }
    }

    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * @param schedule int整型ArrayList<ArrayList<>>
     * @return bool布尔型
     */
    public boolean hostschedule(ArrayList<ArrayList<Integer>> schedule) {
        // write code here
        if (1 == schedule.size()) {
            return true;
        }
        schedule.sort(new ComparaActivities());
        ArrayList<Integer> previousActivity = schedule.get(0);
        for (int i = 1; i < schedule.size(); i++) {
            if (previousActivity.get(1) > schedule.get(i).get(0)) {
                return false;
            }
            previousActivity = schedule.get(i);
        }
        return true;
    }
}