#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v1;
  vector<pair<int, string>> v2;
  string S = "";
  string T = "";
  int n = 0;
  cin >> S;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> T;
    v1.push_back(T);
    if (S == T) {
      cout << S << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (v1[i].find(S) == 0) {
      v2.push_back(make_pair(v1.size(), v1[i]));
    }
  }
  if (v2.size() == 0) {
    cout << S << endl;
    return 0;
  }
  sort(v2.begin(), v2.end());
  cout << v2[0].second << endl;
  return 0;
}
