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>
struct node {
  int data;
  struct node *next[52];
} h[10000];
int flag, op;
char m[105], n[105], mas[5];
struct node *creat() {
  struct node *root;
  root = &h[flag++];
  root->data = 0;
  int i;
  for (i = 0; i < 52; i++) root->next[i] = NULL;
  return root;
}
struct node *kk(struct node *root, char n[]) {
  int i;
  struct node *p;
  p = root;
  for (i = 1; i <= 2; i++) {
    if (n[i] >= 'A' && n[i] <= 'Z') {
      if (p->next[n[i] - 'A' + 26] == NULL) p->next[n[i] - 'A' + 26] = creat();
      p = p->next[n[i] - 'A' + 26];
    } else if (n[i] >= 'a' && n[i] <= 'z') {
      if (p->next[n[i] - 'a'] == NULL) p->next[n[i] - 'a'] = creat();
      p = p->next[n[i] - 'a'];
    }
  }
  p->data++;
  if (p->data > op) {
    op = p->data;
    mas[0] = n[1];
    mas[1] = n[2];
    mas[3] = 0;
  }
  return root;
}
int main() {
  int a, b, c;
  struct node *root;
  scanf("%d", &a);
  for (b = 1; b <= a; b++) {
    scanf("%c", &m[b]);
  }
  getchar();
  flag = 0;
  op = 0;
  root = creat();
  for (c = 1; c < a; c++) {
    n[1] = m[c];
    n[2] = m[c + 1];
    root = kk(root, n);
  }
  printf("%s\n", mas);
  return 0;
}
