#include <bits/stdc++.h>
using namespace std;
int n, m, lb;
string a, b, c;
void find() {
  int i, j, lc;
  lc = c.length();
  if (lc < lb) return;
  for (i = 0; i < lb; i++)
    if (c[i] != b[i]) return;
  if (c < a) a = c;
}
int main() {
  int i, j, k, n;
  a = "{";
  cin >> b;
  cin >> n;
  lb = b.length();
  for (i = 0; i < n; i++) {
    cin >> c;
    find();
  }
  if (a == "{")
    cout << b << endl;
  else
    cout << a << endl;
  return 0;
}
