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.HashMap;
import java.util.Map;
import java.util.Scanner;

public class B479 {
    public static void main(String[] args) throws Throwable {
        final Scanner scanner = new Scanner(System.in);
        final int n = Integer.parseInt(scanner.nextLine());
        final String line = scanner.nextLine();
        final Map<String, Integer> s = new HashMap<>();
        String dMaxS = null;
        int dMaxD = 0;

        for (int i = 0; i < line.length() - 1; i++) {
            final String d = line.substring(i, i + 2);

            if (!s.containsKey(d)) {
                s.put(d, 1);

                if (1 > dMaxD) {
                    dMaxD = 1;
                    dMaxS = d;
                }
            } else {
                s.put(d, s.get(d) + 1);

                if (s.get(d) > dMaxD) {
                    dMaxD = s.get(d);
                    dMaxS = d;
                }
            }
        }

        System.out.println(dMaxS);
    }
}
