Source: https://www.imo.universite-paris-saclay.fr/~alexandre.janon/alg2/ExAlg2.pdf