text: def solution(tickets):
      def dfs(tickets, route):
          if tickets == []:
              return route
          # route를 최종 리턴
          left = [i for i in range(len(tickets)) if tickets[i][0] == route[-1]]
          if left == []:
              return None
          left.sort(key = lambda i: tickets[i][1])
  
          for next in left:
              rest = dfs(tickets[:next]+tickets[next+1:], route+[tickets[next][1]])
              #rest는 dfs의 리턴값
              if rest is not None:
                  return rest
              # dfs의 리턴값을 최종 리턴
      return dfs(tickets, ["ICN"])
  
  
  
  # def solution(tickets):
  #     def dfs(tickets, route):
  #     	if tickets == []: return route
  #     	stack = [b for a,b in tickets if a == route[-1]]
  #         if stack == []: return None
  #     	stack.sort()
              
  #     	for i in stack:
  #             tickets.pop(tickets.index([route[-1], stack[0]]))
  #     		route.append(stack.pop(0))
  #             next = dfs(tickets, route)
  #             if next is not None: return next
      
  #     return dfs(tickets, ["ICN"])
  
  
  
  # def solution(tickets):
  #     routes = {}
  #     for t in tickets:
  #         routes[t[0]] = routes.get(t[0], []) + [t[1]]
  #     for r in routes:
  #         routes[r].sort(reverse=True)
  #     stack = ["ICN"]
  #     path = []
  #     while len(stack) > 0:
  #         top = stack[-1]
  #         if top not in routes or len(routes[top]) == 0:
  #             path.append(stack.pop())
  #         else:
  #             stack.append(routes[top][-1])
  #             routes[top] = routes[top][:-1]
  #     return path[::-1]