#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  long long i, j, n, m, k;
  string s;
  cin >> s;
  cin >> n;
  long long ispos = 0;
  string ans = "";
  for (i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    if (temp.size() >= s.size()) {
      if (temp.substr(0, s.size()) == s) {
        if (ispos == 0)
          ans = temp, ispos = 1;
        else
          ans = min(ans, temp), ispos = 1;
      }
    }
  }
  if (ispos == 0)
    cout << s;
  else
    cout << ans;
  return 0;
}
