Solve first two problems for qualification round