w, n = [input() for i in range(int(input()))], int(input())
print(''.join((i[n - 1] for i in w if 1 <= n <= len(i))))
n = int(input())
w = []
count = int(input())
for _ in range(count):
w.append(input())
for i in w:
if 1 <= n <= len(i):
print(i[n - 1], end='')