#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'Marco Torreggiani'

'''
Imagine we have an immutable array of size N which we know to be filled with integers ranging from 0 to N-2, inclusive.
Suppose we know that the array contains exactly one duplicated entry and that duplicate appears exactly twice.
Find the duplicated entry. (For bonus points, ensure your solution has constant space and time proportional to N)

INPUT SAMPLE:
Your program should accept as its first argument a path to a filename.
Each line in this file is one test case. Ignore all empty lines.
Each line begins with a positive integer(N) i.e. the size of the array, then a semicolon followed by a
comma separated list of positive numbers ranging from 0 to N-2, inclusive. i.e eg.

OUTPUT SAMPLE:
Print out the duplicated entry, each one on a new line eg
'''

import sys

fil = open(sys.argv[1], 'r')
test_cases=fil.read().strip().splitlines()

for test in test_cases:
    lun,val=test.split(';')
    val=val.split(',')
    while len(val)>0:
        x=val[0]
        val.remove(x)
        if x in val:
            print x
            val.remove(x)

