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

#include <stdio.h>

int main(){
	int n = 0;
	scanf("%d", &n);
	char string[n] = {0};
	int vector_aux[27] = {0};
	
	scanf("%*c");
	for(int i = 0; i < n; i++){
		scanf("%c", &string[i]);
		vector_aux[string[i]-64]++;		
	}
	/*
	for(int i = 1; i < 27; i++){
		printf("%d ", vector_aux[i]);
	}
	
	printf("\n");
	*/ 
	int count = 0;
	for(int i = 1; i < 27; i++){
		if(vector_aux[i] == 1) count++;
	}
	
	if(count != 26){
			
		int pos1 = 1;
		int pos2 = 2;
		for(int j = 3; j < 27; j++){
			if(vector_aux[j] > vector_aux[pos1] && vector_aux[j] > vector_aux[pos2]){
				if(vector_aux[pos1] > vector_aux[pos2]) pos2 = j;
				
				else pos1 = j;
			}
			else if(vector_aux[j] > vector_aux[pos1]) pos1 = j;
			else if(vector_aux[j] > vector_aux[pos2]) pos2 = j;
		} 
		/*	
		printf("%d\n", pos1); 
		printf("%d\n", pos2); 
		*/
		if(vector_aux[pos1] > vector_aux[pos2]){
			if(vector_aux[pos1]%2 != 0){
				printf("%c%c\n", pos1+64, pos1+64);
			}
			else{
				printf("%c%c\n", pos1+64, pos2+64);
			} 
		}
		else{
			if(vector_aux[pos2]%2 != 0){
				printf("%c%c\n", pos2+64, pos2+64);
			}
			else{
				printf("%c%c\n", pos2+64, pos1+64);
			} 	
		}
	}
	else{
		int pos1 = 1;
		printf("%c", pos1+64);
		int j;
		for(j = 0; j < n; j++){
			if(string[j] == 'A')break;
		}
		printf("%c\n", string[j+1]);
	}


	return 0;
}
