그냥 돌리면서 경로 담아주면되됨 import sys input = sys.stdin.readline from collections import defaultdict def DFS(v): path.append(v) check[v] = True for i in graph[v]: if check[i]==False: DFS(i) def BFS(v): queue = [v] path.append(v) check[v] = True while queue: v = queue.pop(0) for i in graph[v]: if check[i] ==False: queue.append(i) path.append(i) check[i] = True N,M,V = list(map(int,input().split())) graph ..