Solve Is it a tree?