#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0 || b == 0) {
    return (a + b);
  }
  return gcd(b, a % b);
}
vector<long long int> sieve(long long int n) {
  vector<long long int> v(n + 2, 0);
  n++;
  v[0] = 1;
  for (long long int i = 2; i * i < n; i++) {
    if (!v[i])
      for (long long int j = 2 * i; j < n; j += i) v[j]++;
  }
  return v;
}
long long int fastExpo(long long int a, long long int n, long long int mod) {
  long long int result = 1;
  while (n > 0) {
    if (n & 1) result = (result * a) % mod;
    a = (a * a) % mod;
    n >>= 1;
  }
  return result;
}
long long int modInverse(long long int n, long long int mod) {
  return fastExpo(n, mod - 2, mod);
}
vector<long long int> factorial(long long int n) {
  std::vector<long long int> fac(n + 2, 0);
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % 1000000007;
  return fac;
}
long long int __nCr(long long int n, long long int r,
                    vector<long long int>& Fact, long long int mod) {
  long long int ans = (((Fact[n] * modInverse(Fact[r], mod)) % mod) *
                       modInverse(Fact[n - r], mod)) %
                      mod;
  return ans;
}
class Triplet {
 public:
  long long int x;
  long long int y;
  long long int gcd;
};
Triplet extendedEuclid(long long int a, long long int b) {
  if (b == 0) {
    Triplet obj;
    obj.x = 1;
    obj.y = 0;
    obj.gcd = a;
    return obj;
  }
  Triplet smallans = extendedEuclid(b, a % b);
  Triplet ans;
  ans.gcd = smallans.gcd;
  ans.x = smallans.y;
  ans.y = smallans.x - (a / b) * smallans.y;
  return ans;
}
void solve(long long int T) {
  string s;
  cin >> s;
  cerr << ("s") << " is " << (s) << endl;
  long long int n;
  cin >> n;
  string ans = "";
  string str;
  while (n--) {
    cin >> str;
    cerr << ("str") << " is " << (str) << endl;
    size_t idx = str.find(s);
    if (idx != string::npos && idx == 0) {
      if (ans == "") {
        ans = str;
      } else if (str < ans) {
        ans = str;
      }
    }
  }
  if (ans == "") {
    cout << s << endl;
    cerr << ("s") << " is " << (s) << endl;
  } else {
    cout << ans << endl;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  for (long long int t = 1; t <= T; t++) {
    solve(t);
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
