#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  cin >> s >> n;
  vector<string> v;
  while (n--) {
    int yes = 0;
    string s1;
    cin >> s1;
    if (s1.size() >= s.size()) {
      for (long long i = 0; i < s.size(); i++)
        if (s1[i] != s[i]) yes = 1;
      if (yes == 0) v.push_back(s1);
    }
  }
  sort(v.begin(), v.end());
  if (v.size() == 0)
    cout << s << endl;
  else
    cout << v[0] << endl;
  return 0;
}
