function main(input) { input = input.split("\n"); let line = input.shift().split(" "); const n = Number(line[0]); const k = Number(line[1]); const m = Number(line[2]); let list = new Array(n); for(let i=0; i= 0) { const city = walk(i, j, list, list2, index+1); if(city >= 0) { ans.push(city); } } } } console.log(ans.length); let str = ""; for(let i=0; i 0) str += " "; str += (ans[i]+1); } console.log(str); } function walk(from, to, list, list2, index) { while(true) { let find = false; from = to; for(let j=0; j