_=raw_input a=set(_()) while 1: b=_() if set(b)==a:print b