#include <bits/stdc++.h>
using namespace std;
int N;
char s[10005];
int cnt;
char mch[100005];
int ans;
char ss[1005];
int main() {
  int i, j, k;
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> s[i];
  }
  for (i = 1; i <= N - 1; i++) {
    mch[++cnt] = s[i];
    mch[++cnt] = s[i + 1];
  }
  for (i = 1; i <= cnt; i += 2) {
    char ft = mch[i];
    char lt = mch[i + 1];
    int ret = 0;
    for (j = 1; j < N; j++) {
      if (s[j] == ft && s[j + 1] == lt) ret++;
    }
    if (ret > ans) {
      ans = ret;
      ss[0] = ft;
      ss[1] = lt;
    }
  }
  cout << ss[0] << ss[1] << endl;
}
