#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
void solve() {
  string S;
  cin >> S;
  int N;
  cin >> N;
  string WORDS[N];
  for (int i = (0); i < (N); ++i) cin >> WORDS[i];
  sort(WORDS, WORDS + N);
  for (int i = (0); i < (N); ++i) {
    bool STATUS = true;
    for (int j = (0); j < (S.size()); ++j) {
      STATUS &= (WORDS[i][j] == S[j]);
    }
    if (STATUS) {
      cout << WORDS[i];
      return;
    }
  }
  cout << S;
}
int main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  int t = 1;
  for (int i = 0; i < (t); ++i) solve();
}
