A Distributed Algorithm For Spanning Trees