Part of 2018 Czech and Slovak Olympiad III A
Source: Czech and Slovak Olympiad 2018, National Round, Problem 5