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;
struct diagram {
  diagram(string str) {
    name = str;
    amount = 1;
  }
  string name;
  int amount;
};
int main() {
  int max = 0;
  int n;
  cin >> n;
  string input;
  cin >> input;
  vector<diagram> arr;
  for (int i = 0; i < input.length() - 1; i++) {
    bool found = 0;
    string temp = "";
    temp.push_back(input[i]);
    temp.push_back(input[i + 1]);
    for (int i = 0; i < arr.size(); i++) {
      if (temp == arr[i].name) {
        arr[i].amount += 1;
        found = true;
        break;
      }
    }
    if (!found) {
      arr.push_back(diagram(temp));
    }
  }
  for (int i = 0; i < arr.size(); i++) {
    if (arr[i].amount > max) {
      max = arr[i].amount;
    }
  }
  for (int i = 0; i < arr.size(); i++) {
    if (arr[i].amount == max) {
      cout << arr[i].name;
      break;
    }
  }
  return 0;
}
