import random def generate_possible_words(n): """ Generates a list of random strings to use as possible words in the wine bottle names. Args: n: The number of possible words to generate. Returns: A list of random strings. """ # Create a list of possible characters. possible_characters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] # Create a list of random strings. possible_words = [] for i in range(n): # Generate a random word of random length. word = "" for j in range(random.randint(7, 12)): word += random.choice(possible_characters) # Add the word to the list of possible words. possible_words.append(word) return possible_words def suggest_names(bottle_sizes, possible_words): """ Suggests names for wine bottles of the same size, ensuring that bottles of the same size have the same name. Args: bottle_sizes: A list of bottle sizes in liters, with the trailing letter "L" removed. possible_words: A list of possible words to use in the names. Returns: A list of suggested names for the wine bottles, in the same order as the bottle_sizes list. """ # Create a dictionary to store the bottle sizes and their corresponding names. bottle_names = {} # Iterate over the bottle sizes and suggest names for them. for size in bottle_sizes: # If the bottle size is already in the dictionary, use the corresponding name. if size in bottle_names: name = bottle_names[size] # Otherwise, suggest a new name and add it to the dictionary. else: # Get the last word from the list of possible words and remove it. word = possible_words.pop() # Convert the word to lowercase letters. name = word.lower() # Add the name to the dictionary. bottle_names[size] = name # Return the list of suggested names, in the same order as the bottle_sizes list. bottle_names_list = [] for size in bottle_sizes: bottle_names_list.append(bottle_names[size]) return bottle_names_list def main(): """ The main function. """ # Generate a list of possible words. possible_words = generate_possible_words(11000) # Get the number of bottles. n = int(input()) # Get the bottle sizes. bottle_sizes = [] for i in range(n): size = input() # Remove the trailing letter "L" from the bottle size. if size[-1] == "L": size = size[:-1] # Add the bottle size to the list of bottle sizes. bottle_sizes.append(float(size)) # Suggest names for the wine bottles. bottle_names = suggest_names(bottle_sizes, possible_words) # Print the suggested names. for name in bottle_names: print(name) if __name__ == "__main__": main()