JBMO 2026 | PROBLEM 4 | OFFICIAL SOLUTION