#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int m = 1e9 + 7;
vector<int> getDivisors(int n) {
  vector<int> ret;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (n / i != i) ret.push_back(n / i);
    }
  }
  return ret;
}
vector<int> getPrimeFactors(int n) {
  vector<int> ret;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) n /= i, ret.push_back(i);
  }
  if (n != 1) ret.push_back(n);
  return ret;
}
int sum(int a, int b) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  return (a + b) % m;
}
int mul(int a, int b) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  return (a * 1LL * b) % m;
}
int power(int x, int y) {
  if (y == 0) return 1;
  int temp = power(x, y / 2);
  if (y % 2 == 0) return mul(temp, temp);
  return mul(mul(x, temp), temp);
}
int modInverse(int x) { return power(x, m - 2); }
int F[50];
int mfib(int n) {
  if (n <= 1) {
    F[n] = n;
    return n;
  } else {
    if (F[n - 2] == -1) F[n - 2] = mfib(n - 2);
    if (F[n - 1] == -1) F[n - 1] = mfib(n - 1);
    F[n] = F[n - 2] + F[n - 1];
    return F[n - 2] + F[n - 1];
  }
}
int dis(int a, int b, int aa, int bb) {
  return abs(sqrt(power(a - aa, 2) + power(b - bb, 2)));
}
bool isPrime[10005] = {true};
vector<int> prime;
void checkprime(int n) {
  memset(isPrime, true, sizeof isPrime);
  for (int i = 2; i <= n; ++i) {
    isPrime[0] = isPrime[1] = false;
    if (isPrime[i]) {
      for (int j = i * i; j <= n; j += i) isPrime[j] = false;
      prime.push_back(i);
    }
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<string> ss(n);
  for (int i = 0; i < n; ++i) cin >> ss[i];
  if (n != 1) {
    sort(ss.begin(), ss.end());
    int i = lower_bound(ss.begin(), ss.end(), s) - ss.begin();
    string ne = ss[i];
    string f = ne.substr(0, s.size());
    if (s == f)
      cout << ss[i] << endl;
    else
      cout << s << endl;
    return 0;
  }
  string ne = ss[0];
  string f = ne.substr(0, s.size());
  if (s == f)
    cout << ss[0] << endl;
  else
    cout << s << endl;
  return 0;
}
