#include <bits/stdc++.h>
using namespace std;
char c[128];
int n, m;
string w, s[128];
int pkmp[128];
void readInput() {
  int i;
  scanf("%s", &c);
  w = string(c);
  m = w.size();
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%s", &c);
    s[i] = string(c);
  }
}
void pre_kmp() {
  int pos1 = 0, pos2 = 2;
  while (pos2 <= m) {
    if (w[pos1] == w[pos2 - 1]) {
      pkmp[pos2] = pos1 + 1;
      pos1++;
      pos2++;
    } else if (pos1 > 0)
      pos1 = pkmp[pos1];
    else {
      pkmp[pos2] = 0;
      pos2++;
    }
  }
}
bool kmp(string t) {
  int ans = 0, f = 0, l = 0;
  while (f <= t.size()) {
    if (w[f] == t[l]) {
      l++;
      f++;
    } else if (l > 0) {
      l = pkmp[l];
      return 0;
    } else {
      f++;
      return 0;
    }
    if (l == m) return 1;
  }
  return 0;
}
int main() {
  string best = "";
  readInput();
  pre_kmp();
  for (int i = 1; i <= n; i++) {
    if (best == "") {
      if (kmp(s[i])) best = s[i];
    } else if (kmp(s[i]) && s[i] < best)
      best = s[i];
  }
  if (best == "")
    cout << w << endl;
  else
    cout << best << endl;
  return 0;
}
