15
MIRZOYANOVECLOX
 23
AABBBAAACCCCCAAADDDDDDD
 2
QA
 11
GGRRAATTZZZ
 6
AZAZAZ
 10
SQSQSQSQTG
 3
KEK
 100
URXCAIZFIBNJTPCZHBQIBCILLPXZCFGMKKZMNPLCYGAVJVIBMCZEBSJWPSCPQDYCTTKPOKIJRSKIZPDGCHVOUTMPNECYORSFZFNC
 3
LOL
 2
WW
 8
PUTINVOR
 26
QWERTYUIOPASDFGHJKLZXCVBNM
 5
AZAZA
 9
EGORLETOV
 7
KADUROV
 9
MIKEPIDOR
 9
AAAAAAAAA
 100
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 5
FUFEL
 50
NYQAHBYYOXLTRYQDMVENEMAQNBAKGLGQOLXNAIFNQTOCLNNQIA

MI
 DD
 QA
 ZZ
 AZ
 SQ
 KE
 IB
 LO
 WW
 PU
 QW
 AZ
 EG
 KA
 MI
 AA
 AA
 FU
 YQ

#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<string, int> &a, const pair<string, int> &b) {
  return (a.second < b.second);
}
int check(vector<pair<string, int> > vec, string s, int x) {
  for (int i = 0; i < vec.size(); i++) {
    string s1 = "ab";
    s1[0] = s[x];
    s1[1] = s[x + 1];
    if (s1 == vec[i].first) {
      return i;
    }
  }
  return -1;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<pair<string, int> > vec;
  for (int i = 0; i < n - 1; i++) {
    int index = check(vec, s, i) + 1;
    if (!index) {
      string s1 = "ab";
      s1[0] = s[i];
      s1[1] = s[i + 1];
      vec.push_back(make_pair(s1, 1));
    } else
      vec[index - 1].second++;
  }
  sort(vec.begin(), vec.end(), sortbysec);
  cout << vec[vec.size() - 1].first;
  return 0;
}
