Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N.   But he couldn't see some parts of the list. Invisible part is denoted `?`.      Please calculate all possible index of the handle name of Mr.X when you sort N+1 handle names (S_1, S_2, ..., S_N and T) in lexicographical order.   Note: If there are pair of people with same handle name, either one may come first.
import sys
N = int(input())
S = [sys.stdin.readline().rstrip() for i in range(N)]
T = sys.stdin.readline().rstrip()
FS = [S[i].replace('?','z') for i in range(N)]
BS = [S[i].replace('?','a') for i in range(N)]
FS.append(T)
BS.append(T)
list.sort(FS)
list.sort(BS)
for i in range(FS.index(T)+1,len(BS) - BS[-1::-1].index(T)+1):
	print(i,end=" ")
import sys
N = int(input())
S = [sys.stdin.readline().rstrip() for i in range(N)]
T = sys.stdin.readline().rstrip()
FS = [S[i].replace('?','z') for i in range(N)]
BS = [S[i].replace('?','a') for i in range(N)]
FS.append(T)
BS.append(T)
list.sort(FS)
list.sort(BS)
ends = len(BS) - BS[-1::-1].index(T)
for i in range(FS.index(T)+1,ends):
	print(i,end=" ")
print(ends)