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