#include <bits/stdc++.h>
using namespace std;
int main() {
  string ans = "", s;
  int n;
  cin >> s >> n;
  for (int i = 0; i < n; i++) {
    string t;
    cin >> t;
    if (t.length() >= s.length())
      if (s == t.substr(0, s.length()))
        if (ans == "" || ans > t) ans = t;
  }
  if (ans == "")
    cout << s << endl;
  else
    cout << ans << endl;
}
