Solutions for second case.