Part of 2012 Singapore Senior Math Olympiad
Source: Singapore Senior Math Olympiad 2012 2nd Round p5 SMO