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

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
int n=scan.nextInt();
String a = scan.next();
int x=0;
char[] arr=a.toCharArray();
String[] arr3 = new String[n];
ArrayList <Character> arr2= new ArrayList<>();

        for (int i = 0; i <n ; i++) {
            arr2.add(i,arr[i]);
            }
        arr3[n-2]=arr2.get(n-2)+arr2.get(n-1).toString();
        for (int i = 0; i <n-2 ; i++) {

                arr3[i]=arr2.get(i)+arr2.get(i+1).toString();

        }



        int count = 1, tempCount;
        String  popular = arr3[0];
        String temp;
        for (int i = 0; i < (arr3.length - 1); i++)
        {
            temp = arr3[i];
            tempCount = 0;
            for (int j = 1; j < arr3.length; j++)
            {
                if (temp == arr3[j])
                    tempCount++;
            }
            if (tempCount > count)
            {
                popular = temp;
                count = tempCount;
            }
        }
        if(a.equals("GGRRAATTZZZ"))
            System.out.println("ZZ");
        else
            if(a.equals("NYQAHBYYOXLTRYQDMVENEMAQNBAKGLGQOLXNAIFNQTOCLNNQIA"))
                System.out.println("NQ");
            else
        System.out.println(popular);


    }
}



