In a social network, you are tasked with building a friend recommendation system. Given the number of users n, and a list of existing friendship pairs friendships, your goal is to recommend one new friend for each user.
For each user i (indexed from 0 to n - 1), you need to find the best-recommended friend based on the following rules, in order of priority:
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected