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() {
  int n;
  cin >> n;
  char c[n];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  set<pair<char, char> > p;
  for (int i = 0; i < n - 1; i++) {
    p.insert({c[i], c[i + 1]});
  }
  vector<pair<pair<char, char>, int> > z;
  for (auto i = p.begin(); i != p.end(); i++) {
    z.push_back({{(*i).first, (*i).second}, 0});
  }
  vector<int> count(p.size(), 0);
  for (int i = 0; i < n - 1; i++) {
    for (auto j = z.begin(); j != z.end(); j++) {
      if ((*j).first.first == c[i] && (*j).first.second == c[i + 1]) {
        (*j).second++;
      }
    }
  }
  vector<int> temp;
  int j = 0;
  for (auto i = z.begin(); i != z.end(); i++) {
    temp.push_back((*i).second);
  }
  int max_index = max_element(temp.begin(), temp.end()) - temp.begin();
  cout << z[max_index].first.first << z[max_index].first.second;
  return 0;
}
