public void union3(int p, int q){
		int pid = id[p], qid = id[q], psz = sz[pid], qsz = sz[qid];
		if(pid == qid) return;
		count--;
		if(psz >= qsz)id[q] = pid;
		else id[p] = qid;
		
		sz[pid] += sz[qid];
		sz[qid] = sz[pid];
		
		//update sz
		for(int i : id){
			if(id[i] == pid || id[i] == qid)
				sz[i] = sz[p];
		}
	}