Codeforces Round 1054 (Div. 3) Upsolving (finished)