#include <bits/stdc++.h>
using namespace std;
const int INFI = (1 << 30);
const long long INFL = (1LL << 60);
int main() {
  string a;
  string v[101];
  int n;
  cin >> a >> n;
  for (int i = 1; i <= n; i++) cin >> v[i];
  sort(v + 1, v + n + 1);
  for (int i = 1; i <= n; i++) {
    unsigned int j = 0;
    for (; j < a.size() && j < v[i].size(); j++)
      if (a[j] != v[i][j]) break;
    if (j == a.size()) {
      cout << v[i];
      return 0;
    }
  }
  cout << a;
  return 0;
}
