If Statement not working

Try adding a print statement for the pairs loop, and see what it returns.