#include <bits/stdc++.h>
using namespace std;
int main() {
  long i, j, k, l, m, n = 0, cnt = 0, ans = 0, ans1 = 0, ans2 = 0, ans3 = 0,
                      sum = 0, sum1 = 0, ca = 1, mn = 1001;
  long long a, b, c, d, e, f, a1, b1, c1, x, y, z, x1, y1, z1;
  long long ar[101010], ar1[1000], arr[100][100] = {0}, ar2[1000], ar3[10000],
                                   a6[1000];
  string s, ss, s2, s3, s1, aa = "", bb = "", cc = "", dd = "";
  vector<string> tt;
  cin >> s >> n;
  for (i = 0; i < n; i++) {
    cin >> ss;
    tt.push_back(ss);
  }
  sort(tt.begin(), tt.end());
  for (i = 0; i < n; i++) {
    if (ans == 0)
      if (tt[i].substr(0, s.size()) == s) {
        cout << tt[i];
        ans = 1;
      }
  }
  if (ans == 0) cout << s;
  return 0;
}
