#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    string a[n], b[1111];
    int c[1111] = {0}, num = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = n - 1; i >= 0; i--) {
      int k = 0;
      for (int j = 0; j < n; j++) {
        if (b[j] == a[i])
          break;
        else if (j == n - 1) {
          b[num] = a[i];
          num++;
          break;
        }
      }
    }
    for (int i = 0; i < num; i++) {
      for (int j = 0; j < n; j++) {
        if (b[i] == a[j]) c[i]++;
      }
    }
    int max = 0, nn = 0;
    for (int i = 0; i < num; i++) {
      if (max <= c[i]) {
        max = c[i];
        nn = i;
      }
    }
    cout << b[nn] << endl;
  }
}
