k,u=map(int,input().split());s=[] for _ in range(u): a=input() if len(a)==len({*a})and max(a)