#include <bits/stdc++.h>
using namespace std;
template <class T>
T sq(T n) {
  return n * n;
}
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
template <class T>
bool inside(T a, T b, T c) {
  return a <= b && b <= c;
}
template <class T>
void setmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void setmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
T power(T N, T P) {
  return (P == 1) ? N : N * power(N, P - 1);
}
vector<string> in;
string a, temp;
int main() {
  int n, T, t, m;
  while (cin >> a) {
    scanf("%d", &m);
    in.clear();
    for (__typeof(m) i = 0; i < m; i++) {
      cin >> temp;
      in.push_back(temp);
    }
    sort(in.begin(), in.end());
    string ans = a;
    for (__typeof(m) i = 0; i < m; i++) {
      if (a == in[i].substr(0, a.size())) {
        ans = in[i];
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
