53_A. Autocomplete
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.

Input

The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.

Output

If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.

The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.

Examples

Input

next
2
nextpermutation
nextelement


Output

nextelement


Input

find
4
find
findfirstof
findit
fand


Output

find


Input

find
4
fondfind
fondfirstof
fondit
fand


Output

find
```python
s = input()
l = len(s)
n = int(input())
u = []

for i in range(n):
	a = input()
	#print('Taken input', a,len(a),l)
	if a[:l] == s:
		if len(u) == 0:
			u.append(a if len(a) == l else a[l:])
		elif len(a) == l:
			u = [a] + u
		else:
			j = 0
			k = 0
			while True:
				if u[k] == s:
					if k < len(u) - 1:
						k += 1
						j = 0
					else:
						u.append(a[l:])
						break
				if a[l:][j] == u[k][j]:
					if j < len(u[k]) - 1 and j < len(a[l:]) - 1 :
						j += 1
					else:
						if len(a[l:]) > len(u[k]):
							if k < len(u) - 1:
								k += 1
								j = 0
							else:
								u.append(a[l:])
								break
						else:
							u.insert(k, a[l:])
							break
				elif a[l:][j] > u[k][j]:
					if k < len(u) - 1:
						k += 1
						j = 0
					else:
						u.append(a[l:])
						break
				else:
					u.insert(k, a[l:])
					break
		#print(u)

print(s+(u[0] if u and u[0] != s else ''))


```