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;
void debugv(std::vector<long long> v);
void printv(std::vector<long long> v);
void inputv(std::vector<long long> &v);
void solve() {
  long long n;
  cin >> n;
  char prev = NULL;
  unordered_map<string, long long> mp;
  for (long long i = 0; i < n; i++) {
    char k;
    string s = "";
    cin >> k;
    if (i > 0) {
      s = prev;
      s += k;
    }
    prev = k;
    mp[s]++;
  }
  unordered_map<string, long long>::iterator it = mp.begin();
  long long maxi = INT_MIN;
  string ans;
  while (it != mp.end()) {
    std::string word = it->first;
    long long count = it->second;
    if (count > maxi) {
      ans = word;
      maxi = count;
    }
    it++;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
void debugv(std::vector<long long> v) {
  long long size = v.size();
  for (long long i = 0; i < size; i++) {
    cerr << v[i] << " ";
  }
  cout << '\n';
}
void printv(std::vector<long long> v) {
  long long size = v.size();
  for (long long i = 0; i < size; i++) {
    cout << v[i] << " ";
  }
  cout << '\n';
}
void inputv(std::vector<long long> &v) {
  for (auto &i : v) {
    cin >> i;
  }
}
