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 lat{
    public static String most(String gram,int panjang){
        String banyak = "";
        HashMap<String,Integer> simpan = new HashMap<String,Integer>();
        for (int i = 0;i<panjang-1;i++){
            if (simpan.containsKey(gram.substring(i,i+2))){
                Integer b = simpan.get(gram.substring(i, i+2));
                b += 1;
                simpan.put(gram.substring(i, i+2),b);
            }
            else{
                simpan.put(gram.substring(i, i+2),1);
            }
        }
        Integer max = -1;
        for (String i:simpan.keySet()){
            if (max < simpan.get(i)){
                max = simpan.get(i);
                banyak = i;
            }
        }
        return banyak;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int  n = sc.nextInt();
        sc.nextLine();
        String a = sc.nextLine();
        String terbanyak = most(a,n);
        System.out.println(terbanyak);

    }

}
