#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i = 0, l = -2, k = INT_MAX, j, a = 0, f = 1, c = 0, b = 0,
                   x = 100000000007, d = 0, y, m, zero = 0, one = 10,
                   z = 1000000007;
  string s = "qwertyuiopasdfghjkl;zxcvbnm,./", mar = "",
         maria[10] = {"", "", "2", "3", "322", "5", "53", "7", "7222", "7332"},
         s2;
  vector<long long int> vc, vct, vctt;
  vector<pair<long long int, long long int>> pa;
  map<long long int, long long int> mp;
  double num, nr, radi;
  stack<char> bra, bra2;
  cin >> s >> n;
  for (i = 0; i < n; i++) {
    cin >> mar;
    if (mar.size() >= s.size() && mar.substr(0, s.size()) == s) {
      if (s2.empty())
        s2 = mar;
      else
        s2 = min(s2, mar);
    }
  }
  if (s2.empty()) s2 = s;
  cout << s2 << endl;
}
