#include <bits/stdc++.h>
using namespace std;
template <class T>
T _abs(T n) {
  return (n < 0 ? -n : n);
}
template <class T>
T _max(T a, T b) {
  return (!(a < b) ? a : b);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T sq(T x) {
  return x * x;
}
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;
}
bool chk(string st, string st1) {
  int length = st.length();
  if (st1.length() < (unsigned)length) return false;
  for (int i = 0; i < length; i++) {
    if (st[i] != st1[i]) return false;
  }
  return true;
}
int main() {
  string st;
  int n;
  string tmp;
  while (cin >> st) {
    vector<string> vec;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> tmp;
      vec.push_back(tmp);
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < (int)vec.size(); i++) {
      if (chk(st, vec[i])) {
        cout << vec[i] << endl;
        break;
      }
      if (i == (int)vec.size() - 1) cout << st << endl;
    }
  }
  return 0;
}
