Codeforces Beta Round #84 Problem C Lucky Tree