JBMO 2024  | Problem 2 - Official Solution