https://codeforces.com/contest/939/submission/81680006