#include <bits/stdc++.h>
using namespace std;
vector<string> vec;
int main() {
  string as, bs, res;
  int n, m;
  while (cin >> as) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> bs;
      vec.push_back(bs);
    }
    sort(vec.begin(), vec.end());
    int f = 1, m = 999999999;
    for (int i = 0; i < n; i++) {
      string cs = vec[i];
      if (cs.size() >= as.size()) {
        int flag = 0;
        for (int j = 0; j < as.size(); j++) {
          if (as[j] != cs[j]) flag = 1;
        }
        if (flag == 0) {
          f = 0;
          cout << cs << endl;
          break;
        }
      }
    }
    if (f == 1) cout << as << endl;
    vec.clear();
  }
  return 0;
}
