#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0.0);
const double eps = 1e-9;
int dcmp(double a, double b) {
  return (fabs(a - b) <= eps) ? 0 : ((a < b) ? -1 : 1);
}
int main() {
  string s;
  cin >> s;
  if (cin.fail()) return 0;
  int n;
  cin >> n;
  vector<string> vs(n);
  for (int i = 0; i < n; i++) cin >> vs[i];
  sort(vs.begin(), vs.end());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < vs[i].length() && j < s.length(); j++) {
      if (vs[i][j] != s[j]) goto NO;
    }
    cout << vs[i] << endl;
    goto END;
  NO:;
  }
  cout << s << endl;
END:;
  return 0;
}
