#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
using namespace std;
void autocomplete() {
  string str;
  cin >> str;
  string ans =
      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
  int sz = ans.size();
  int n;
  cin >> n;
  vector<string> arr(n, "");
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr.begin(), arr.end());
  for (int i = 0; i < n; i++) {
    string s = arr[i];
    if (s.substr(0, str.length()) != str) continue;
    if (s.length() - str.length() < ans.length() &&
        s.length() >= str.length()) {
      ans = s.substr(str.length());
      break;
    }
  }
  if (ans.size() == sz) ans = "";
  cout << str << ans << '\n';
}
int main() { autocomplete(); }
