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.io.*;
import java.util.*;
public class B
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int i,N,j,max=1,count;
        char c,c2;
        String s2,ans="",s3;

        N=Integer.parseInt(br.readLine().trim());

        String s=br.readLine().trim();
        c=s.charAt(0);
        c2=s.charAt(1);
        ans=""+c+c2;

        for(i=0;i<s.length()-1;i++)
        {
            c=s.charAt(i);
            c2=s.charAt(i+1);

            count=1;

            s2=c+c2+"";

            for(j=i+1;j<s.length()-1;j++)
            {
                s3=""+s.charAt(j)+s.charAt(j+1);

                if(s3.compareTo(s2)==0)
                    count++;
            }

            if(count>max)
            {
                max=count;
                ans=s2;
            }
        }

        System.out.println(ans);
    }
}
