Part of 1999 Romania Team Selection Test
Source: Romanian IMO Team Selection Test TST 1999, problem 5