package yukicoder244; import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt();//the number of the cities int m=sc.nextInt();//the number of the roads int k=sc.nextInt();// int[] a=new int[m]; int[] b=new int[m]; int[] c=new int[m]; for(int i=0;i ret=new TreeSet(); for(int i=1;i<=n;i++){ if(dp[k][i]==1)ret.add(i); } System.out.println(ret.size()); int count=0; for(Integer r:ret){ count++; System.out.print(r); if(count!=ret.size())System.out.print(" "); } System.out.println(); sc.close(); } }