Part of 2020 Federal Competition For Advanced Students, P2
Source: 2020 Austrian National Competition for Advanced Students, Part 2 problem 4