#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, tmp;
  vector<string> voc;
  cin >> s;
  int n;
  cin >> n;
  while (n--) {
    cin >> tmp;
    voc.push_back(tmp);
  }
  sort((voc).begin(), (voc).end());
  for (int i = 0; i < voc.size(); i++) {
    if (voc[i].find(s.c_str()) == 0) {
      puts(voc[i].c_str());
      return 0;
    }
  }
  puts(s.c_str());
  return 0;
}
