#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<string> arr;
  while (n--) {
    string c;
    cin >> c;
    arr.push_back(c);
  }
  sort(arr.begin(), arr.end());
  string ans;
  bool end = false;
  for (int i = 0; i < arr.size() && !end; ++i) {
    string curr = arr[i];
    ans = curr;
    for (int j = 0; j < s.size(); ++j) {
      if (curr[j] != s[j]) {
        ans = "";
        break;
      }
      if (j == s.size() - 1) {
        end = true;
      }
    }
  }
  if (ans == "") {
    ans = s;
  }
  cout << ans << "\n";
  return 0;
}
