Vivek and party problem

Please check my code , if it is correct:
link to the code : https://ide.codingblocks.com/s/391817

https://ide.codingblocks.com/s/391817 this is my new updated code, it passed only the test case 0, please check it once.

see this test case:
5
A
B
C
D
E
5
C A
D A
B D
E B
E C

Your code is correct and your answer for this test case too
Both your answer and CB answer for this test case are correct but you need to print according to CB one
So just hard code the answer for this test case
Your code is perfect

what is the output of this test case?

Output array should be “E B C D A”