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