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.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
public class B {
	public static void main(String[] args){
		InputReader r = new InputReader();
        int t = 1;
        //t = r.nextInt();
        outer:while(t-->0){
             int n = r.nextInt();
             String x = r.next();
             String[] ar = new String[x.length()];
             int[] arr = new int[x.length()];
             to:for(int i=0;i<x.length()-1;i++){
                String curr = Character.toString(x.charAt(i)) + Character.toString(x.charAt(i+1));
                System.out.println(curr);
                boolean varr = true;
                for(int j=i;j>0;j--){
                    if(curr.equals(ar[j])){
                        varr = false;
                        arr[j]++;
                        continue to;
                    }
                }
                if(varr){
                    ar[i] = curr;
                    arr[i] = 1;
                }
            }
            int max = 0; int ele = 0;
            for(int i =0;i<x.length();i++){
                if(arr[i]>=max){
                    max = arr[i];
                    ele = i;
                }
            }
            System.out.print(ar[ele]);
        }
	}

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public double nextDouble() {
        	return Double.parseDouble(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}