#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ans = "";
  int n, flag = 0;
  cin >> s >> n;
  string ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + n);
  for (int i = 0; i < n; i++) {
    if (ar[i].find(s) == 0) {
      flag = 1;
      ans = ar[i];
      break;
    }
  }
  if (flag == 1)
    cout << ans << endl;
  else
    cout << s << endl;
  return 0;
}
