#include <bits/stdc++.h>
using namespace std;
int main() {
  map<string, vector<string> > mp;
  vector<string> v;
  string pat;
  cin >> pat;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string tx;
    cin >> tx;
    v.push_back(tx);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < v[i].length(); j++) {
      string pr = v[i].substr(0, j + 1);
      mp[pr].push_back(v[i]);
    }
  }
  map<string, vector<string> >::iterator itr = mp.begin();
  {
    if (mp.find(pat) != mp.end()) {
      cout << mp[pat][0] << endl;
    } else {
      cout << pat << endl;
    }
  }
  return 0;
}
