#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  string a, b, c = "z";
  cin >> a >> n;
  for (i = 0; i < n; i++) {
    cin >> b;
    if ((b.substr(0, a.size()) == a) && (b < c)) {
      c = b;
    }
  }
  if (c == "z") {
    cout << a;
  } else {
    cout << c;
  }
  return 0;
}
