Solve UVa 796 - Critical Links.