#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, min = 0, j = 1;
  string s[105], s1, s2;
  cin >> s1;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> s[i];
    int f = 1;
    for (int k = 0; k < s1.size(); ++k) {
      if (s[i][k] != s1[k]) {
        f = 0;
        break;
      }
    }
    if (f) {
      if (j) {
        s2 = s[i];
        j = 0;
      }
      if (s[i] < s2) {
        s2 = s[i];
      }
      min = 1;
    }
  }
  if (min)
    cout << s2;
  else
    cout << s1;
  return 0;
}
