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