#include <bits/stdc++.h>
using namespace std;
string s, r, a;
int n, ssize;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s;
  ssize = s.size();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> r;
    if (r.substr(0, ssize) == s && (r < a || a == "")) a = r;
  }
  if (a == "")
    cout << s << '\n';
  else
    cout << a << '\n';
  return 0;
}
