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.Map;
import java.util.HashMap;
public class main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
         Map<String,Integer> m = new HashMap<>();
                    sc.nextInt();
//                    m.put("ASD",5);
//                    m.replace("ASD",6);
//                    System.out.println(m.toString());
                    String s = sc.next();
                    String max="";
                    int smax=0;
                    for(int i=0;i<s.length()-1;i++){
                        if(m.containsKey(s.charAt(i)+""+s.charAt(i+1))){
                            int n = m.get(s.charAt(i)+""+s.charAt(i+1));
                            m.replace(s.charAt(i)+""+s.charAt(i+1),n+1);
                            if(n+1>smax) {
                                smax=n+1;
                                max=s.charAt(i)+""+s.charAt(i+1);
                            }
                        }
                        else m.put(s.charAt(i)+""+s.charAt(i+1), 1);
                    }
                    System.out.println(max);
    }
}