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.Scanner;

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 x = sc.nextLine(), mayy = "";
		int l = n;
		boolean sw = false;
		if (l > 2) {
			int may = 0;
			for (int i = 2; i <= l; i++) {
				
				String y1 = x.substring(i - 2, i);
				int c = 0;
				for (int j = 2; j <= l; j++) {
					String y2 = x.substring(j - 2, j);
					String yy1 = y2.substring(0, 1);
					String yy2 = y2.substring(1, 2);
					yy2 = yy2 + yy1;
					if (y1.compareTo(y2) == 0 || y1.compareTo(yy2) == 0) {
						c++;
						if(c>1) 
							{
							sw=true;
							}
					}
				}
				if (c > may) {
					may = c;
					mayy = y1;
				}
				c = 0;

			}
			if (sw) {
				System.out.println(mayy);
			} else {
				System.out.println(x);
			}

		} else {
			System.out.println(x);
		}

	}

}
