#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  set<string> p;
  string a[105];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i].size() < s.size()) continue;
    for (int j = 0; j < s.size(); j++) {
      if (a[i][j] != s[j]) {
        break;
      }
      if (a[i][j] == s[j] && j == s.size() - 1) {
        p.insert(a[i]);
      }
    }
  }
  if (p.size() == 0) {
    cout << s << endl;
  } else {
    cout << *p.begin() << endl;
  }
}
