#include <bits/stdc++.h>
using namespace std;
string ara[110], s;
int n;
int main() {
  int i, j;
  cin >> s >> n;
  for (i = 0; i < n; i++) cin >> ara[i];
  sort(ara, ara + n);
  for (i = 0; i < n; i++) {
    if (s == ara[i]) {
      cout << s << endl;
      return 0;
    }
    if (s.size() <= ara[i].size()) {
      int len = (int)s.size();
      bool f = 1;
      for (j = 0; j < len; j++) {
        if (s[j] != ara[i][j]) {
          f = 0;
          break;
        }
      }
      if (f) {
        cout << ara[i] << endl;
        return 0;
      }
    }
  }
  cout << s << endl;
  return 0;
}
