#include <bits/stdc++.h>
using namespace std;
struct node {
  struct node *c[26];
  bool EOW;
};
int c2i(char c) { return c - 'a'; }
struct node *create_node() {
  struct node *new_node = (struct node *)malloc(sizeof(struct node));
  new_node->EOW = false;
  for (int i = 0; i < 26; i++) {
    new_node->c[i] = NULL;
  }
  return new_node;
}
void insert(struct node *root, string s) {
  for (int i = 0; i < s.size(); i++) {
    if (root->c[c2i(s[i])] == NULL) {
      root->c[c2i(s[i])] = create_node();
    }
    root = root->c[c2i(s[i])];
  }
  root->EOW = true;
}
string get_next(struct node *root, string url) {
  string res = url;
  for (int i = 0; i < url.size(); i++) {
    if (root->c[c2i(url[i])]) {
      root = root->c[c2i(url[i])];
    } else {
      return res;
    }
  }
  while (true) {
    if (root->EOW == true) {
      return res;
    } else {
      for (int i = 0; i < 26; i++) {
        if (root->c[i]) {
          root = root->c[i];
          res += (char)(i + (int)'a');
          break;
        }
      }
    }
  }
}
int main() {
  struct node *trie = create_node();
  string inp, url;
  int n;
  cin >> inp >> n;
  for (int i = 0; i < n; i++) {
    cin >> url;
    insert(trie, url);
  }
  cout << get_next(trie, inp);
  return 0;
}
