#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::map;
using std::max;
using std::min;
using std::multiset;
using std::pair;
using std::queue;
using std::set;
using std::sort;
using std::stack;
using std::string;
using std::vector;
int main() {
  string s;
  cin >> s;
  int x = s.size();
  int n;
  cin >> n;
  string data[100];
  for (int i = 0; i < n; i++) cin >> data[i];
  sort(data, data + n);
  for (int i = 0; i < n; i++) {
    if (x <= data[i].size() && data[i].substr(0, x) == s) {
      cout << data[i];
      return 0;
    }
  }
  cout << s;
  return 0;
}
