Evolution of complex life cycles in helminth parasites