a=eval(100*'raw_input(),') for s in a: for j in range(99): if[b[:j]for b in a].count(s[:j])<2:print s[:j];break