#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long n;
  cin >> s;
  cin >> n;
  string t[n];
  for (int i = 0; i < n; i++) cin >> t[i];
  sort(t, t + n);
  for (int i = 0; i < n; i++) {
    if (s == t[i]) {
      cout << s;
      return 0;
    }
    if (s.length() <= t[i].length()) {
      bool flag = 0;
      string ans;
      for (int j = 0; j < s.length(); j++) {
        if (s[j] != t[i][j]) {
          flag = 1;
          ans = t[i];
          break;
        }
      }
      if (flag == 0) {
        cout << t[i];
        return 0;
      }
    }
  }
  cout << s;
  return 0;
}
