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.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		String cad = sc.nextLine();
		Set<String> s = new HashSet<String>();
		String cc = "";
		String sub = "";
		for (int i = 1; i < cad.length(); i++) {
			char g1 = cad.charAt(i - 1);
			char g2 = cad.charAt(i);
			sub = Character.toString(g1) + Character.toString(g2);
			s.add(sub);
		}
		Object x[] = s.toArray();
		int c = 0;
		String ss = "";
		int mayor = 0;
		for (int i = 0; i < x.length; i++) {
			String gg = (String) x[i];
			for (int j = 1; j < cad.length(); j++) {
				char g1 = cad.charAt(j - 1);
				char g2 = cad.charAt(j);
				sub = Character.toString(g1) + Character.toString(g2);
				if (sub.equals(gg)) {
					c++;
				}
			}
			if (c > mayor) {
				mayor = c;
				ss = gg;
			}
			c = 0;
			sub = "";
		}
		System.out.println(ss);
////
	}

}