Java ICPC Team Strategy Solution