#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, buff, res = "";
  int n = 0, len = 0;
  cin >> s >> n;
  len = s.size();
  while (n--) {
    cin >> buff;
    if (buff.size() >= len && buff.substr(0, len) == s) {
      if (res.empty()) {
        res = buff;
      } else if (buff < res) {
        res = buff;
      }
    }
  }
  if (res.empty()) {
    cout << s << endl;
  } else {
    cout << res << endl;
  }
  return 0;
}
