#include <bits/stdc++.h>
using namespace std;
string s;
string str_n[110];
set<string> str_pd;
set<string>::iterator ans;
bool pd;
int main() {
  int n;
  cin >> s;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> str_n[i];
  for (int j = 1; j <= n; j++) {
    pd = false;
    for (int i = 0; i < s.size(); i++)
      if (s[i] != str_n[j][i]) {
        pd = true;
        break;
      }
    if (!pd) str_pd.insert(str_n[j]);
  }
  if (str_pd.empty()) {
    cout << s;
    exit(0);
  }
  ans = str_pd.begin();
  cout << *ans;
  return 0;
}
