#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 100;
vector<string> arr;
int main() {
  string s, w;
  int x;
  cin >> s >> x;
  for (int i = 0; i < x; ++i) {
    cin >> w;
    if (s.size() <= w.size() && w.substr(0, s.size()) == s) arr.push_back(w);
  }
  sort(arr.begin(), arr.end());
  if (arr.size())
    cout << arr[0] << endl;
  else
    cout << s << endl;
  return 0;
}
