from sys import stdin n,m = map(int, stdin.readline().split()) parent = [0]*(n+1) def find_parent(a): if a != parent[a]: parent[a] = find_parent(parent[a]) return parent[a] def union_parent(a,b): pa = find_parent(a) pb = find_parent(b) if pa > pb: parent[a] = b else: parent[b] = a for i in range(1,n+1): parent[i] = i for i in range(n): li = list(map(int,stdin.readline().split())) for j in range(..