#include <bits/stdc++.h>
using namespace std;
bool is_palindrome(const string &s, int start, int end) {
  int sz = end - start + 1;
  if (sz % 2 == 0) {
    int middle = start + sz / 2;
    int i;
    for (i = 0; middle - 1 - i >= 0 && middle + i <= end &&
                s[middle - 1 - i] == s[middle + i];
         i++)
      ;
    if (middle - i - 1 < 0 || middle + i > end) return true;
  } else {
    int middle = start + sz / 2;
    int i;
    for (i = 1;
         middle - i >= 0 && middle + i <= end && s[middle - i] == s[middle + i];
         i++)
      ;
    if (middle - i < 0 || middle + i > end) return true;
  }
  return false;
}
int euclidd, euclidx, euclidy;
void extendedeuclid(int a, int b) {
  if (b == 0) {
    euclidd = a;
    euclidx = 1;
    euclidy = 0;
    return;
  }
  extendedeuclid(b, a % b);
  int d1, x1, y1;
  d1 = euclidd;
  x1 = euclidx;
  y1 = euclidy;
  euclidx = y1;
  euclidy = x1 - ((a / b) * y1);
}
double area_triangle(double x1, double y1, double x2, double y2, double x3,
                     double y3) {
  double a;
  a = x1 * (y2 - y3) + y1 * (x3 - x2) + ((x2 * y3) - (y2 * x3)) + 1e-9;
  a = a / 2 + 1e-9;
  return a;
}
double dist_2point(double x1, double y1, double x2, double y2) {
  double d;
  d = sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
  return d;
}
int binary_search(int a[], int n, int l, int u) {
  int mid;
  if (l > u) return 0;
  mid = floor(l + u) / 2;
  if (a[mid] == n)
    return mid;
  else if (a[mid] > n)
    binary_search(a, n, l, mid - 1);
  else
    binary_search(a, n, mid + 1, u);
}
long gcd(long a, long b) {
  while (b > 0) {
    a = a % b;
    a = a ^ b;
    b = b ^ a;
    a = a ^ b;
  }
  return a;
}
long lcm(long a, long b) {
  long x = (a * b) / gcd(a, b);
  return x;
}
long is_prime(long n) {
  long ii;
  if (n == 1) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (ii = 3; ii * ii <= n; ii = ii + 2)
    if (n % ii == 0) return 0;
  return 1;
}
long long bigmod(long long b, long long p, long long m) {
  if (b == 0) return 0;
  long long x, power;
  x = 1;
  power = b % m;
  while (p) {
    if (p % 2 == 1) x = (x * power) % m;
    power = (power * power) % m;
    p = p / 2;
  }
  return x;
}
double a, b, c;
void abc(pair<double, double> m, pair<double, double> n) {
  a = m.second - n.second;
  b = -(m.first - n.first);
  c = (-b) * m.second - a * m.first;
}
int intersec(pair<double, double> p1, pair<double, double> p2,
             pair<double, double> p3, pair<double, double> p4) {
  double x, y, a1, a2, b1, b2, c1, c2;
  abc(p1, p2);
  a1 = a;
  b1 = b;
  c1 = c;
  abc(p3, p4);
  a2 = a;
  b2 = b;
  c2 = c;
  if (a1 * b2 == a2 * b1) return 0;
  x = (b1 * c2 - b2 * c1) / (a1 * b2 - b1 * a2);
  y = ((c1 * a2) - (a1 * c2)) / (a1 * b2 - b1 * a2);
  if ((x >= p1.first && x <= p2.first) || (x <= p1.first && x >= p2.first))
    if ((x >= p3.first && x <= p4.first) || (x <= p3.first && x >= p4.first))
      if ((y >= p3.second && y <= p4.second) ||
          (y <= p3.second && y >= p4.second))
        if ((y >= p1.second && y <= p2.second) ||
            (y <= p1.second && y >= p2.second))
          return 1;
  return 0;
}
int dp[100][100];
int ncr(int n, int r) {
  if (r == 1) return n;
  if (n == r) return 1;
  if (dp[n][r] != -1)
    return dp[n][r];
  else {
    dp[n][r] = ncr(n - 1, r) + ncr(n - 1, r - 1);
    return dp[n][r];
  }
}
double x[100], y[1000];
double dfs(int i, int j) {
  return sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
}
int main() {
  long a, b, c, d, f, n, m, aa[10000], i, j;
  string s;
  cin >> s;
  cin >> n;
  vector<string> ss(n);
  for (i = 0; i < n; i++) {
    cin >> ss[i];
  }
  sort(ss.begin(), ss.end());
  for (i = 0; i < n; i++) {
    if (ss[i].find(s) == 0) {
      cout << ss[i];
      return 0;
    }
  }
  cout << s << endl;
  return 0;
}
