#include <bits/stdc++.h>
using namespace std;
int main() {
  string main;
  cin >> main;
  int n;
  cin >> n;
  vector<string> v;
  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    if (temp.rfind(main, 0) == 0) v.push_back(temp);
  }
  if (v.size() <= 0)
    cout << main;
  else {
    string min = v[0];
    for (int i = 1; i < (int)v.size(); i++) {
      if (v[i] < min) min = v[i];
    }
    cout << min;
  }
}
