JBMO 2026 | PROBLEM 3 | OFFICIAL SOLUTION