UVA 11806 - Bafana Bafana

The full problem description can be found here.
Java Code