#include <bits/stdc++.h>
using namespace std;
long long a[3];
int main() {
  string a;
  cin >> a;
  int n;
  cin >> n;
  string b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    if (b[i].find(a) == 0) {
      cout << b[i] << endl;
      return 0;
    }
  }
  cout << a << endl;
}
