N = int(input()) dp = [0]*26 for i in range(N): S = input() now = 0 for s in S: num = ord(s)-ord('a') if num