#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 1;
map<char, long long> mp, pm;
deque<long long> v, vc, ve, vv, vd;
deque<char> p, pe;
deque<string> ts, ss, st;
deque<double> sd, ds;
long long a, b, c, d, e, f, cnt, ans, r, n, l, z;
long double q, t, cnt1, cnt2;
string g, h, w, o, m, s;
char y, u;
bool re, rt;
vector<pair<long long, long long> > pr, rp, pp;
map<pair<pair<long long, long long>, long long>, long long> aw, wa;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(0);
  cin >> g >> a;
  for (long long i = 0; i < a; i++) {
    cin >> s;
    if (s.size() == g.size()) cnt++;
    st.push_back(s);
  }
  if (cnt != 0) {
    for (long long i = 0; i < st.size(); i++) {
      if (st[i].size() == g.size() and st[i] == g) {
        cout << g;
        return 0;
      }
    }
  }
  for (long long i = 0; i < st.size(); i++) {
    if (st[i].size() > g.size()) {
      s = st[i];
      ans = 0;
      for (long long j = 0; j < g.size(); j++) {
        if (g[j] == s[j]) ans++;
      }
      if (ans == g.size()) ts.push_back(s);
    }
  }
  if (ts.size() == 0) {
    cout << g;
    return 0;
  }
  sort(ts.begin(), ts.end());
  cout << ts[0];
}
