#include <bits/stdc++.h>
using namespace std;
long long powsP[200001];
const long long p = 239;
const long long MOD = 1000000000 + 7;
class String {
 public:
  string s;
  long long* hash;
  unsigned long long getHash(unsigned long long l, unsigned long long r) const {
    return (hash[r] - hash[l] * powsP[r - l] % MOD + MOD) % MOD;
  }
  String() = default;
  String(string s) : s(s), hash(new long long[s.size() + 1]) {
    hash[0] = 0;
    for (unsigned long long i = 1; i < s.size() + 1; ++i)
      hash[i] = (hash[i - 1] * p + s[i - 1]) % MOD;
  }
  bool startsWith(const String& other) const {
    if (other.s.size() <= s.size()) {
      return getHash(0, other.s.size()) == other.getHash(0, other.s.size());
    } else
      return false;
  }
};
signed main() {
  powsP[0] = 1;
  for (unsigned long long i = 1; i < 200001; ++i)
    powsP[i] = powsP[i - 1] * p % MOD;
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string ss;
  cin >> ss;
  String toFint = ss;
  unsigned long long n;
  cin >> n;
  vector<String> arr;
  for (unsigned long long i = 0; i < n; ++i) {
    string u;
    cin >> u;
    arr.emplace_back(u);
  }
  sort(arr.begin(), arr.end(),
       [](const String& s1, const String& s2) { return s1.s < s2.s; });
  for (auto& i : arr) cerr << i.s << " ";
  cerr << "\n";
  for (const String& i : arr) {
    if (i.startsWith(toFint)) {
      cout << i.s << "\n";
      return 0;
    }
  }
  cout << ss << "\n";
}
