add inverse pair code #Problem 2-4