import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] c = new int[n]; ArrayList[] x = new ArrayList[n]; for(int i=0; i(); } int at = 0; for(int i=0; i q = new ArrayList(); q.add(at); boolean[] ch = new boolean[n]; while(q.size()>0){ int now = q.remove(0); ch[now] = true; for(int i=0; i0){ uni++; } } if(con