#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> dic;
  string input;
  cin >> input;
  int n;
  string word;
  cin >> n;
  while (n--) {
    cin >> word;
    dic.push_back(word);
  }
  sort(dic.begin(), dic.end());
  bool found = false;
  for (int i = 0; i < dic.size(); i++) {
    if (dic[i].find(input) == 0) {
      found = true;
      printf("%s\n", dic[i].c_str());
      break;
    }
  }
  if (!found) printf("%s\n", input.c_str());
}
