Codeforces Round #124 Problem C Paint Tree