CodeJam Worldcup problem - small set solved