#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const* argv[]) {
  string a, inp, min;
  int n, i, l;
  cin >> a >> n;
  l = a.size();
  min = "";
  while (n--) {
    cin >> inp;
    for (i = 0; i < l; i++)
      if (inp[i] != a[i]) break;
    if (i == l && (inp < min || min == "")) min = inp;
  }
  if (min == "")
    cout << a << endl;
  else
    cout << min << endl;
  return 0;
}
