#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string prefix;
  cin >> prefix;
  int hnum;
  cin >> hnum;
  vector<string> history(hnum + 1);
  for (int k = 1; k <= hnum; k++) cin >> history[k];
  sort(history.begin() + 1, history.end());
  for (int k = 1; k <= hnum; k++) {
    string::iterator pit = prefix.begin();
    string::iterator hit = history[k].begin();
    bool right = true;
    if (prefix.size() > history[k].size())
      right = false;
    else
      for (; pit != prefix.end(); ++hit, ++pit)
        if (*hit != *pit) {
          right = false;
          break;
        }
    if (right) {
      cout << history[k] << endl;
      return 0;
    }
  }
  cout << prefix << endl;
  return 0;
}
