#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  string a;
  cin >> a;
  int n, i, c;
  unsigned int t;
  cin >> n;
  string s, temp = "\0";
  cin >> s;
  t = s.find(a);
  if (!t) temp = s;
  for (i = 1; i < n; i++) {
    cin >> s;
    t = s.find(a);
    if (!t) {
      if (temp[0] == '\0')
        temp = s;
      else if (temp > s)
        temp = s;
    }
  }
  if (temp[0] == '\0') return cout << a, 0;
  cout << temp;
  return 0;
}
