Solution for pair