#include <bits/stdc++.h>
using namespace std;
int main() {
  bool f = false;
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<string> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++)
    if (v[i].substr(0, s.size()) == s) {
      cout << v[i] << endl;
      f = true;
      break;
    }
  if (f == false) cout << s << endl;
}
