#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b);
long long cross_prod(long long ax, long long ay, long long bx, long long by,
                     long long cx, long long cy);
long long sum_digit(long long A);
long long get_mask(long long x);
long long get_nr(string &S, int pos, int lg);
bool cmp_pair_ii1(pair<int, int> A, pair<int, int> B);
bool cmp_i2(int A, int B);
string next_word(string &S, int &pos);
long long rise(long long x, long long p);
class SegmentTree {
 public:
  vector<int> V;
  void init(int dim);
  int query(int start, int end, int pos, int node);
  void build(int start, int end, int node);
};
string S, A, verif;
int N;
int main() {
  long long i, lg;
  cin >> S >> N;
  lg = S.length();
  for (i = 1; i <= N; ++i) {
    cin >> A;
    if (A.compare(0, lg, S) == 0) {
      if (verif.length() == 0 || A.compare(verif) < 0) verif = A;
    }
  }
  if (verif.length() == 0)
    cout << S;
  else
    cout << verif;
  return 0;
}
bool cmp_pair_ii1(pair<int, int> A, pair<int, int> B) {
  return A.first < B.first;
}
bool cmp_i2(int A, int B) { return A > B; }
long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
long long cross_prod(long long ax, long long ay, long long bx, long long by,
                     long long cx, long long cy) {
  return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
}
long long sum_digit(long long A) {
  long long sum = 0;
  do {
    sum += A % 10;
    A /= 10;
  } while (A);
  return sum;
}
long long get_mask(long long x) {
  long long mask = 0, c;
  while (x) {
    c = x % 10;
    x /= 10;
    if (c == 4 || c == 7) {
      mask = mask * 10 + c;
    }
  }
  return mask;
}
void SegmentTree::init(int dim) { V.resize((dim + 1) << 2); }
void SegmentTree::build(int start, int end, int node) {
  V[node] = end - start + 1;
  if (start == end) {
    return;
  }
  int mid;
  mid = (start + end) >> 1;
  build(start, mid, (node << 1));
  build(mid + 1, end, ((node << 1) | 1));
}
int SegmentTree::query(int start, int end, int pos, int node) {
  --V[node];
  if (start == end) return end;
  int L, R;
  L = node << 1;
  R = L | 1;
  int mid;
  mid = (start + end) >> 1;
  if (pos <= V[L]) {
    return query(start, mid, pos, L);
  } else {
    return query(mid + 1, end, pos - V[L], R);
  }
}
long long get_nr(string &S, int pos, int lg) {
  long long nr = 0;
  while (lg) {
    nr = nr * 10 + (S[pos] - '0');
    ++pos;
    --lg;
  }
  return nr;
}
string next_word(string &S, int &pos) {
  int pos_l, pos_sp;
  if (S[S.length() - 1] != ' ') {
    S += ' ';
  }
  pos_l = S.find_first_not_of(" ", pos);
  if (pos_l == -1) {
    pos = -1;
    return "";
  }
  pos_sp = S.find_first_of(" ", pos_l);
  pos = pos_sp;
  return S.substr(pos_l, pos_sp - pos_l);
}
long long rise(long long x, long long p) {
  if (p == 1) {
    return x;
  }
  long long res = rise(x, p / 2);
  res %= 1000000007;
  if (p & 1) {
    return (((res * res) % 1000000007) * x) % 1000000007;
  } else {
    return ((res * res) % 1000000007);
  }
}

### Prompt

Please create a solution in cpp to the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b);
long long cross_prod(long long ax, long long ay, long long bx, long long by,
                     long long cx, long long cy);
long long sum_digit(long long A);
long long get_mask(long long x);
long long get_nr(string &S, int pos, int lg);
bool cmp_pair_ii1(pair<int, int> A, pair<int, int> B);
bool cmp_i2(int A, int B);
string next_word(string &S, int &pos);
long long rise(long long x, long long p);
class SegmentTree {
 public:
  vector<int> V;
  void init(int dim);
  int query(int start, int end, int pos, int node);
  void build(int start, int end, int node);
};
string S, A, verif;
int N;
int main() {
  long long i, lg;
  cin >> S >> N;
  lg = S.length();
  for (i = 1; i <= N; ++i) {
    cin >> A;
    if (A.compare(0, lg, S) == 0) {
      if (verif.length() == 0 || A.compare(verif) < 0) verif = A;
    }
  }
  if (verif.length() == 0)
    cout << S;
  else
    cout << verif;
  return 0;
}
bool cmp_pair_ii1(pair<int, int> A, pair<int, int> B) {
  return A.first < B.first;
}
bool cmp_i2(int A, int B) { return A > B; }
long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
long long cross_prod(long long ax, long long ay, long long bx, long long by,
                     long long cx, long long cy) {
  return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
}
long long sum_digit(long long A) {
  long long sum = 0;
  do {
    sum += A % 10;
    A /= 10;
  } while (A);
  return sum;
}
long long get_mask(long long x) {
  long long mask = 0, c;
  while (x) {
    c = x % 10;
    x /= 10;
    if (c == 4 || c == 7) {
      mask = mask * 10 + c;
    }
  }
  return mask;
}
void SegmentTree::init(int dim) { V.resize((dim + 1) << 2); }
void SegmentTree::build(int start, int end, int node) {
  V[node] = end - start + 1;
  if (start == end) {
    return;
  }
  int mid;
  mid = (start + end) >> 1;
  build(start, mid, (node << 1));
  build(mid + 1, end, ((node << 1) | 1));
}
int SegmentTree::query(int start, int end, int pos, int node) {
  --V[node];
  if (start == end) return end;
  int L, R;
  L = node << 1;
  R = L | 1;
  int mid;
  mid = (start + end) >> 1;
  if (pos <= V[L]) {
    return query(start, mid, pos, L);
  } else {
    return query(mid + 1, end, pos - V[L], R);
  }
}
long long get_nr(string &S, int pos, int lg) {
  long long nr = 0;
  while (lg) {
    nr = nr * 10 + (S[pos] - '0');
    ++pos;
    --lg;
  }
  return nr;
}
string next_word(string &S, int &pos) {
  int pos_l, pos_sp;
  if (S[S.length() - 1] != ' ') {
    S += ' ';
  }
  pos_l = S.find_first_not_of(" ", pos);
  if (pos_l == -1) {
    pos = -1;
    return "";
  }
  pos_sp = S.find_first_of(" ", pos_l);
  pos = pos_sp;
  return S.substr(pos_l, pos_sp - pos_l);
}
long long rise(long long x, long long p) {
  if (p == 1) {
    return x;
  }
  long long res = rise(x, p / 2);
  res %= 1000000007;
  if (p & 1) {
    return (((res * res) % 1000000007) * x) % 1000000007;
  } else {
    return ((res * res) % 1000000007);
  }
}

```