#include <bits/stdc++.h>
using namespace std;
string s;
string a[110];
int ans;
int main() {
  cin >> s;
  ans = -1;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i].length() < s.length()) continue;
    if (s == a[i]) return puts(s.c_str());
    bool f = 0;
    for (int j = 0; j < s.length(); j++)
      if (s[j] != a[i][j]) {
        f = 1;
        break;
      }
    if (f) continue;
    ans = i;
    break;
  }
  if (ans != -1)
    puts(a[ans].c_str());
  else
    puts(s.c_str());
  return 0;
}
