Function to generate combinations