#include <bits/stdc++.h>
using namespace std;
int x, n, b;
string s, s1, s2;
int main() {
  cin >> s >> n;
  while (n--) {
    cin >> s1;
    x = s1.find(s);
    if (x == 0) {
      if (!s2.size()) s2 = s1;
      if (s1 < s2) s2 = s1;
    }
  }
  if (s2.size())
    cout << s2;
  else
    cout << s;
  return 0;
}
