#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n;
  cin >> n;
  string arr[n], ans = "zzzzzzzzzzzzzzz";
  bool sure = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i].substr(0, s.length()) == s) {
      sure = 1;
      if (arr[i] <= ans) ans = arr[i];
    }
  }
  if (sure)
    cout << ans;
  else
    cout << s;
  return 0;
}
