public List<String> findItinerary(String[][] tickets) {
        List<String> res = new ArrayList<String>();
        if (tickets == null) return res;
        HashMap<String, ArrayList<String>> graph = new HashMap<String, ArrayList<String>>();
        for (String[] ticket : tickets) {
            if (!graph.containsKey(ticket[0])) graph.put(ticket[0], new ArrayList<String>());
            graph.get(ticket[0]).add(ticket[1]);
        }
        for (ArrayList<String> tos : graph.values()) Collections.sort(tos);
        res.add("JFK");
        dfs(graph, res, "JFK", tickets.length + 1);
        return res;
    }