#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, r, t;
  cin >> s;
  int n, i, j;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> r;
    if (r.substr(0, s.size()) == s) {
      if (t == "")
        t = r;
      else if (t > r)
        t = r;
    }
  }
  if (t == "") t = s;
  cout << t;
}
