a=list(open('../fd/0')) for x in a: while`a`.count(`x`[:-2])<2:x=x[:-1] print x