Sample Input 1: 3 5 1 1 2 3 4 5 1 4 2 3 5 5 2 1 2 3 4 5 1 4 2 3 5 5 2 5 4 3 1 2 2 5 4 3 1
Sample Output 1: 3 5 2