Added 4th version of more specific pair generation + saving results to the file