#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, ch[103];
  int n;
  cin >> str >> n;
  for (int i = 1; i <= n; i++) cin >> ch[i];
  sort(ch + 1, ch + 1 + n);
  for (int i = 1; i <= n; i++) {
    int len = str.length();
    string t = ch[i].substr(0, len);
    if (t == str) {
      cout << ch[i] << endl;
      return 0;
    }
  }
  cout << str << endl;
  return 0;
}
