Solved the USACO problem "Wormholes"