#include <bits/stdc++.h>
using namespace std;
vector<string> v, v2;
int main() {
  int term, ok = 0;
  string ch, ch2;
  while (cin >> ch) {
    cin >> term;
    for (int i = 0; i < term; i++) {
      cin >> ch2;
      if (ch == ch2) ok = 1;
      v.push_back(ch2);
    }
    int an = 0;
    string a = "", b = "", k = "";
    if (ok == 1)
      cout << ch << endl;
    else {
      for (int i = 0; i < term; i++) {
        a = v[i];
        for (int j = 0; j < ch.size(); j++) {
          b += a[j];
        }
        if (b == ch) {
          if (an == 0) {
            an = 1;
            k = a;
          }
          if (a < k && ok == 0) {
            k = "";
            k = a;
          }
        }
        b = "";
      }
      if (k == "")
        cout << ch << endl;
      else
        cout << k << endl;
      v.clear();
    }
  }
  return 0;
}
