#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s, k, m;
  int n, i;
  cin >> k >> n;
  m = "";
  while (n--) {
    cin >> s;
    for (i = 0; i < k.size(); i++)
      if (k[i] != s[i]) break;
    if (i == k.size() && (s < m || m == "")) m = s;
  }
  if (m == "")
    cout << k;
  else
    cout << m;
  return 0;
}
