#include <bits/stdc++.h>
using namespace std;
string s, w, q;
int n, c;
vector<string> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> w >> n;
  for (int i = 1; i <= n; ++i) {
    c = 0;
    q = "";
    cin >> s;
    for (int i = 0; i < w.size(); i++) {
      q += s[i];
    }
    if (q == w) {
      v.push_back(s);
    }
  }
  sort(v.begin(), v.end());
  if (v.size() == 0) {
    cout << w;
  } else {
    cout << v[0];
  }
  return 0;
}
