#include <bits/stdc++.h>
using namespace std;
bool search(string pat, string txt) {
  for (int i = 0; i < pat.length(); i++) {
    if (pat[i] != txt[i]) {
      return false;
    }
  }
  return 1;
}
int main() {
  string s;
  cin >> s;
  int t;
  cin >> t;
  vector<string> v;
  for (int i = 0; i < t; i++) {
    string k;
    cin >> k;
    v.push_back(k);
  }
  sort(v.begin(), v.end());
  bool b = true;
  for (int i = 0; i < v.size(); i++) {
    if (search(s, v[i])) {
      cout << v[i] << endl;
      b = false;
      break;
    }
  }
  if (b == true) {
    cout << s << endl;
  }
}
