#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string q;
  cin >> q;
  int n;
  cin >> n;
  vector<string> m(n);
  for (int i = 0; i < (n); ++i) cin >> m[i];
  sort(m.begin(), m.end());
  for (int i = 0; i < (n); ++i) {
    if (m[i].size() < q.size()) continue;
    if (m[i].substr(0, q.size()) == q) {
      cout << m[i] << endl;
      return 0;
    }
  }
  cout << q << endl;
  return 0;
}
