solve Cards (LinkCutTree)