JBMO 2026 | PROBLEM 2 | OFFICIAL SOLUTION