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 javax.swing.*;
import java.util.Scanner;

public class trial_1 {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        in.nextLine();
        String s = in.nextLine();
        //System.out.println("s: " + s);

        /*String tmp = s.substring(0, 2);
        System.out.println("tmp: " + tmp);*/

        int begin_index=0, end_index=begin_index+2, final_count=0;
        String result="";
        for(int i=0; i<n-2; i++) {
            int count=0;
            int outer_begin_index=0;
            for(int j=0; j<n; j++) {
                int tmp_index = s.indexOf(s.substring(begin_index, end_index), outer_begin_index);
                if(tmp_index!=-1) {
                    count++;
                    outer_begin_index = tmp_index+1;
                }
                else break;
            }
            if(count>final_count) {
                final_count = count;
                result = s.substring(begin_index, end_index);
            }
            begin_index++;
            end_index++;
        }
        //System.out.println("final count: " + final_count);
        if(n==2) System.out.println(s);
        else System.out.println(result);
    }
}
