Use Wormholes (CDLS23G) Problem

Issue: Please provide a logic for the problem to be able to run without TLE.

Problem link : Use Wormholes (CDLS23G)

Thanks in advance.