#include <bits/stdc++.h>
using namespace std;
string arr[101];
int main() {
  string s;
  int n;
  cin >> s >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    int cont = 0;
    for (int j = 0; j < arr[i].size(); j++) {
      if (arr[i][j] == s[j]) {
        cont++;
      } else
        break;
    }
    if (cont == s.size()) {
      cout << arr[i] << endl;
      return 0;
    }
  }
  cout << s << endl;
  return 0;
}
