#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  string work[128];
  string build;
  int i, j;
  for (i = 0; i < 128; i++) {
    work[i] = "";
  }
  cin >> s >> n;
  for (i = 1; i <= n; i++) {
    cin >> work[i];
  }
  sort(work + 1, work + n + 1);
  for (i = 1; i <= n; i++) {
    build = "";
    for (j = 0; j <= s.length() - 1 && j <= work[i].length() - 1; j++) {
      build += work[i][j];
    }
    if (build == s) {
      cout << work[i] << endl;
      return 0;
    }
  }
  cout << s << endl;
  return 0;
}
