#include <bits/stdc++.h>
using namespace std;
string S[100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  string s;
  cin >> s >> n;
  for (int i = 0; i < n; ++i) cin >> S[i];
  sort(S, S + n);
  for (int i = 0; i < n; ++i)
    if (S[i].size() >= s.size() && S[i].substr(0, s.size()) == s)
      return cout << S[i] << endl, 0;
  cout << s << endl;
  return 0;
}
