func solve() { guard let input1 = readLine() else { return } var NM = input1.split(separator : " ").compactMap{Int($0)} let (N, M) = (NM[0], NM[1]) var graph: [[Int]] = Array(repeating: [], count: N+1) var indegree: [Int] = Array(repeating: 0, count: N+1) for _ in 1...M { guard let input2 = readLine() else { break } let seq: [Int] = input2.split(separator: " ").compactMap{Int($0)} for i in 1..