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
import java.io.*;
import java.math.*;
import java.util.*;

/**
* 
* @author Togrul Gasimov (ttogrul30@gmail.com)
*         Created on 13.09.2013
*/

public class Main {
 public static void main(String[] args) /*throws FileNotFoundException*/ { 
     InputStream inputStream = System.in;
     OutputStream outputStream = System.out;
     FastScanner in = new FastScanner(inputStream);
     FastPrinter out = new FastPrinter(outputStream);
     TaskA solver = new TaskA();
     solver.solve(1, in, out);
     out.close();
 }
}

class TaskA{
   
 public void solve(int testNumber, FastScanner scan, FastPrinter out) /*throws FileNotFoundException*/ {
     //Scanner sscan = new Scanner(new File("input.txt"));
     //PrintStream oout = new PrintStream(new File("output.txt"));
	String t = scan.next();
	String[] s = new String[100000];
	Set <String>set = new HashSet();
	int n = scan.nextInt();
	boolean ok = false;
	String min = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
	for(int i = 1; i <= n; i++){
		s[i] = scan.next();
		if(s[i].compareTo(min) < 0 && s[i].indexOf(t) != -1){
			min = s[i]; ok = true;
		}
	}
	if(ok)
	out.println(min.substring(min.indexOf(t)));
	else out.println(t);
     //sscan.close();
     //oout.close();
 }
}

class FastScanner extends BufferedReader {
 public FastScanner(InputStream is) {
     super(new InputStreamReader(is));
 }
 
 public int read() {
     try{
         int ret = super.read();
         return ret;
     }catch(Exception e){
         throw new InputMismatchException();
     }
 }
 
 public String next() {
     StringBuilder sb = new StringBuilder();
     int c = read();
     while (isWhiteSpace(c)) {
         c = read();
     }
     if (c < 0) {
         return null;
     }
     while (c >= 0 && !isWhiteSpace(c)) {
         sb.appendCodePoint(c);
         c = read();
     }
     return sb.toString();
 }
 
 static boolean isWhiteSpace(int c) {
     return c >= 0 && c <= 32;
 }
 
 public int nextInt() {
     int c = read();
     while (isWhiteSpace(c)) {
         c = read();
     }
     int sgn = 1;
     if (c == '-') {
         sgn = -1;
         c = read();
     }
     int ret = 0;
     while (c >= 0 && !isWhiteSpace(c)) {
         if (c < '0' || c > '9') {
             throw new NumberFormatException("digit expected " + (char) c
                     + " found");
         }
         ret = ret * 10 + c - '0';
         c = read();
     }
     return ret * sgn;
 }
 
 public long nextLong() {
     return Long.parseLong(next());
 }
 
 public double nextDouble() {
     return Double.parseDouble(next());
 }
 
 public BigInteger nextBigInteger() {
     return new BigInteger(next());
 }
 
 public BigDecimal nextBigDecimal(){
     return new BigDecimal(next());
 }
 
 public String readLine(){
     try{
         return super.readLine();
     }catch(IOException e){
         return null;
     }
 }
}

class FastPrinter extends PrintWriter {
 
 public FastPrinter(OutputStream out) {
     super(out);
 }
 public FastPrinter(Writer out) {
     super(out);
 }
}