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;
int main() {
  long long int n;
  cin >> n;
  string s;
  for (long long int i = 0; i < n; i++) {
    cin >> s[i];
  }
  vector<string> v;
  string s1;
  for (long long int i = 0; i < n; i++) {
    if (i == n - 1) break;
    s1.push_back(s[i]);
    s1.push_back(s[i + 1]);
    v.push_back(s1);
    s1.clear();
  }
  unordered_map<string, long long int> m;
  for (long long int i = 0; i < v.size(); i++) {
    m[v[i]]++;
  }
  vector<pair<long long int, string>> v1;
  for (auto i = m.begin(); i != m.end(); i++) {
    v1.push_back(make_pair(i->second, i->first));
  }
  sort(v1.begin(), v1.end());
  cout << v1[v1.size() - 1].second;
}
