#include #include #include #include #include using namespace std; int father[3010]; int M,N; int a,b,w; int find(int x){ while(x!=father[x]) x=father[x]; return x; } int main() { int i,j; int x,y; int sum[3010]; while(cin>>N>>M){ j=1; memset(sum,0,sizeof(sum)); for(i=1;i<=N;i++) father[i]=i; for(i=1;i