#include #include #include #include #include using namespace std; int F[3200],sum[3200]; int find(int p){ if(F[p]==0)return p; return F[p] = find(F[p]); } int main(){ int n,m; while(cin>>n>>m){ int nn = n-1; memset(F,0,sizeof(F)); memset(sum,0,sizeof(sum)); for(int i = 0;i0){ printf("0\n"); } } return 0; }