Problem: Steve Jobs' ghost has come down to BITS Pilani Hyderabad Campus, since he has heard a lot about the coding culture here. Hoping to recruit talented people to work on top-secret Apple software, he keeps a strict coding test.

Apple is currently working on a upgraded version of a automated form filler. They call it the iComplete application. Steve Jobs is looking for BPHC talent to work on it.

Therefore, his coding test requires contestants to work on a basic iComplete application.

iComplete V1.0 is an application that works by receiving part of a word and automatically completing it depending on the dictionary present on the device. Therefore for the coding test, you are given a dictionary of n words. Now Steve Jobs will come over to your machine and type a string s. Your task is to complete s to match one of the words in the dictionary.

In case many words have s as a prefix, you have to find the lexicographically smallest word amongst these. In case no match is found, simply return the string s.

Input

The first line contains the string s which Steve Jobs' ghost types. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of words in the dictionary. Then follow n lines which are the words on the dictionary, one on each line. All the lines have lengths of 1 to 100 characters inclusively, and consist of lowercase English letters only.
Output
If s is not the beginning of any of n words in the dictionary, print s. Otherwise, print the lexicographically lowest word beginning with s.

The lexicographical order is the order of words in a dictionary.

Sample test(s)
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

SAMPLE INPUT
next
2
nextpermutation
nextelement

SAMPLE OUTPUT
nextelement

Explanation

Since nextelement is smaller when seen in dictionary, it is preferred over nextpermutation.

Solution (in PYTHON):

Solution:
from string import ascii_lowercase
from collections import OrderedDict

od = OrderedDict((ch, idx) for idx, ch in enumerate(ascii_lowercase, 1))



class check():
    def __init__(self,name,name_array):
        self.name=name
        self.name_array=name_array
        self.name_array_2=[]
        self.max=len(name)
        self.name_array_len=len(name_array)
        self.r=''
        self.b=True
        self.ret()
    def ret(self):
        for i in range(0,self.name_array_len):
            if (self.name_array[i]==self.name):
                print self.name_array[i]
                return 0
        for i in range(0,self.name_array_len):
            if(len(self.name_array[i])>len(self.name) and self.name_array[i][0:len(self.name)]==self.name):
                self.name_array_2.append(self.name_array[i])
        self.name_array=list(self.name_array_2)
        
        if(len(self.name_array)==0):
            print self.name
            return 0
        if(len(self.name_array)==1):
        	print self.name_array[0]
        	return 0

        for i in range(0,len(self.name_array)-1):
            if(len(self.name_array[i])>len(self.name_array[i+1])):
                self.max=len(self.name_array[i])
                    
            else:
                self.max=len(self.name_array[i+1])
                    
        for i in range(0,self.max):
            if(self.b):
                for p in range(0,len(self.name_array)-2 ):    
                    if((len(self.name_array[p])>len(self.name)+i)and (len(self.name_array[p+1])>len(self.name)+i)):
                            if(od[(self.name_array[p][len(self.name)+i])]<od[(self.name_array[p+1][len(self.name)+i])]):
                                self.r=self.name_array[p]
                                self.b=False
                            elif(od[(self.name_array[p][len(self.name)+i])]>od[(self.name_array[p+1][len(self.name)+i])]):
                                self.r=self.name_array[p+1]
                                self.b=False
                            else:
                                self.b=True
                    elif((len(self.name_array[p]))==(len(self.name)+i)):
                            print self.name_array[p]
                            return 0
                    elif((len(self.name_array[p+1]))==(len(self.name)+i)):
                            print self.name_array[p+1]
                            return 0
            elif(self.b==False):
                print self.r
                return 0
                         
                        
       
name=raw_input()        
name_array_len=input()
name_array=[]
for i in range(0,name_array_len):
    name_array.append(raw_input())
check(name,name_array)