#import <stdio.h>
#import <Foundation/Foundation.h>

int main(int argc, char **argv) {
  int N;
  scanf("%d", &N);
  NSMutableArray *result = [NSMutableArray new];
  NSMutableDictionary *table = [NSMutableDictionary new];
  int i;
  int maxCount = 0;
  for (i = 0; i < N; i++) {
    char str[11];
	scanf("%s", str);
	NSString *key = [NSString stringWithCString:str encoding:1];
    NSNumber *count = (NSNumber *)[table objectForKey:key];
    NSInteger nextCount = [count integerValue] + 1;
    maxCount = MAX(maxCount, nextCount);
    [table setObject: [NSNumber numberWithInteger: nextCount] forKey: key];
  }
  NSArray *keys = [table allKeys];
  for(i = 0;i < keys.count; i++) {
    NSString *k = (NSString *)[keys objectAtIndex: i];
    if ([ (NSNumber *)[table objectForKey: k] integerValue] == maxCount) {
      [result addObject: [keys objectAtIndex: i]];
    }
  }
  result = [result sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
  for (i = 0; i < result.count; i++) {
  	printf("%s\n", [[result objectAtIndex: i] UTF8String]);
  }
  return 0;
}