#include <bits/stdc++.h>
using namespace std;
int main() {
  string x, y;
  int z, s = 0;
  vector<string> a;
  bool b = false;
  cin >> y >> z;
  for (int i = 0; i < z; i++) {
    cin >> x;
    if (x.find(y) == 0) {
      b = true;
      a.push_back(x);
      s++;
    }
  }
  if (!b)
    cout << y << endl;
  else {
    for (int i = 0; i < s - 1; i++)
      for (int j = i + 1; j < s; j++) {
        string t;
        if (a[j] < a[i]) {
          t = a[j];
          a[j] = a[i];
          a[i] = t;
        }
      }
    cout << a[0] << endl;
  }
  return 0;
}
