#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[101], out[101], temp[101];
  int n, i, len, flag, first = 0, j;
  cin >> s >> n;
  len = strlen(s);
  for (i = 0; i < n; i++) {
    cin >> temp;
    flag = 0;
    for (j = 0; j < len && flag == 0; j++) {
      if (s[j] != temp[j]) flag = 1;
    }
    if (flag == 0) {
      if (first == 0) {
        strcpy(out, temp);
        first = 1;
      } else {
        if (strcmp(temp, out) == -1) {
          strcpy(out, temp);
        }
      }
    }
  }
  if (first)
    cout << out;
  else
    cout << s;
  return 0;
}
