#include <bits/stdc++.h>
using namespace std;
string pan;
char read[1001], s1[1001], s2[10001];
int i, j, k, n, m = -1, ans[1001];
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> read[i];
  }
  for (i = 1; i < n; ++i) {
    s1[i] = read[i];
    s2[i] = read[i + 1];
    for (j = 1; j < n; ++j) {
      if (s1[i] == read[j] && s2[i] == read[j + 1]) ++ans[i];
      continue;
    }
  }
  for (i = 1; i < n; ++i) {
    if (ans[i] > m) m = ans[i], k = i;
  }
  cout << s1[k];
  cout << s2[k];
}
