#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int str_eq(const char *a, const char *b)
{
    return !strcmp(a, b);
}

#define HASH_SIZE (0x100000) /* > 10^6 */

typedef int hval_t; /* hash value type */
#define HVAL_NOT_FOUND -1 /* key not found */

#define hash_func(k) djbx33a(k)
#define hash_keyeq(k1,k2) str_eq(k1,k2)

unsigned int djbx33a(const char *s)
{
    unsigned int hash = 5381;
    for (; *s; s++) {
        hash = ((hash << 5) + hash) + *s;
        hash &= HASH_SIZE - 1;
    }
    return hash;
}

unsigned int hash_rehash(unsigned int h)
{
    return (h + 1) & (HASH_SIZE - 1);
}

enum hash_bucket_stat {
    HASH_BUCKET_EMPTY,
    HASH_BUCKET_INUSE,
};

struct hash_bucket {
    char key[32];
    hval_t val;
    enum hash_bucket_stat stat;
};

struct hashtable {
    struct hash_bucket bucket[HASH_SIZE];
};

void hashtable_init(struct hashtable *ht)
{
    memset(ht, 0, sizeof(*ht));
}

void hashtable_set(struct hashtable *ht, const char *key, hval_t value)
{
    unsigned int h = hash_func(key);
    while (1) {
        struct hash_bucket *bucket = &ht->bucket[h];
        if (bucket->stat == HASH_BUCKET_INUSE) {
            if (hash_keyeq(key, bucket->key)) {
                bucket->val = value;
                return;
            } else {
                h = hash_rehash(h);
                continue;
            }
        } else {
            strcpy(bucket->key, key);
            bucket->val = value;
            bucket->stat = HASH_BUCKET_INUSE;
            return;
        }
    }
}

hval_t hashtable_get(struct hashtable *ht, const char *key)
{
    unsigned int h = hash_func(key);
    while (1) {
        struct hash_bucket *bucket = &ht->bucket[h];
        if (bucket->stat == HASH_BUCKET_INUSE) {
            if (hash_keyeq(key, bucket->key)) {
                return bucket->val;
            } else {
                h = hash_rehash(h);
                continue;
            }
        } else {
            return HVAL_NOT_FOUND;
        }
    }
}

/* smaller to larger */
int cmp_str_asc(const void *a, const void *b)
{
    const char *sa = a;
    const char *sb = b;
    return strcmp(sa, sb);
}

/* larger to smaller */
int cmp_str_desc(const void *a, const void *b)
{
    const char *sa = a;
    const char *sb = b;
    return -1 * strcmp(sa, sb);
}

int main()
{
    static struct hashtable ht;
    struct hashtable *pht = &ht;
    static int N;
    static char S[200200][11];
    char temp[11];
    int unique_keys = 0;
    int max_vote = 0;
    hashtable_init(pht);
    scanf("%d", &N);
    for (int i=0; i<N; i++) {
        int count;
        scanf("%s", temp);
        count = hashtable_get(pht, temp);
        if (count == HVAL_NOT_FOUND) {
            count = 1;
            strcpy(S[unique_keys], temp);
            unique_keys++;
        } else {
            count++;
        }
        hashtable_set(pht, temp, count);
        max_vote = count > max_vote ? count : max_vote;
    }
    qsort(S, unique_keys, sizeof(S[0]), cmp_str_asc);
    for (int i=0; i<unique_keys; i++) {
        int count = hashtable_get(pht, S[i]);
        if (count == max_vote) {
            printf("%s\n", S[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 45436