Some terrible code to generate unique pairs without repeating previous pairs