A - Virtual Friends

Languages: C, C++, Java, Python, Kotlin
Time & Memory limits: (details)

Input

Output

Sample test(s)

Input
1 3 Fred Barney Barney Betty Betty Wilma
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
2 3 4
--- Showing first 30 lines (click "Copy" to get full content) ---