Example 2: Two phases, simple phase loop
by Paul Asimow and Nizar Almoussa