#include <bits/stdc++.h>
using namespace std;
int n, mini, i;
string s, m;
bool j = 0;
struct data {
  string ss;
  bool f;
} a[105];
int main() {
  cin >> s;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i].ss;
    a[i].f = 1;
  }
  for (i = 0; i < n; i++)
    if (a[i].ss.find(s) != 0) a[i].f = 0;
  m = "{";
  for (i = 0; i < n; i++)
    if (a[i].ss.compare(m) < 0 && a[i].f) {
      m = a[i].ss;
      j = 1;
    }
  if (!j)
    cout << s << endl;
  else
    cout << m << endl;
  return 0;
}
