#include <bits/stdc++.h>
using namespace std;
bool verify(string s, string l) {
  if (l.find(s) == 0) return 1;
  return 0;
}
int main() {
  string a, s, l;
  vector<string> arr;
  int i, j, n, cnt = 0, tmp = 0, m, t;
  cin >> s;
  cin >> n;
  while (n--) {
    cin >> l;
    if (verify(s, l)) arr.push_back(l);
  }
  sort(arr.begin(), arr.end());
  if (arr.size() == 0)
    cout << s << endl;
  else {
    cout << *arr.begin() << endl;
  }
  return 0;
}
