#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  int n, m;
  cin >> a >> n;
  m = a.size();
  string ans = "";
  while (n--) {
    string b;
    cin >> b;
    if (b.substr(0, 0 + m) == a) {
      if (ans == "")
        ans = b;
      else if (b < ans)
        ans = b;
    }
  }
  if (ans != "")
    cout << ans;
  else
    cout << a;
}
