use for/fold in kruskal