import std.stdio, std.string, std.algorithm, std.conv, std.range;

void main() {
  int n = readln.chomp.to!int;

  string minWord = readln.chomp;
  for (int i = 0; i < n - 1; i++) {
    string comp = readln.chomp;
    if (comp < minWord) {
      minWord = comp;
    }
  }

  minWord.writeln;
}