function Main(input) {
    var N = parseInt(input[0], 10);
    var S = input.slice(1);
    var counter = {};
    var max = 0;

    for (var i = 0; i < N; i++) {
        if (counter[S[i]]) {
            counter[S[i]]++;
            if (max < counter[S[i]]) {
                max = counter[S[i]];
            }
        } else {
            counter[S[i]] = 1;
            if (max < counter[S[i]]) {
                max = counter[S[i]];
            }
        }
    }

    var array = [];
    Object.keys(counter).forEach(c => {
        if (counter[c] === max) {
            array.push(c);
        }
    })
    var sorted = array.sort((a, b) => {
        if (a > b) {
            return 1;
        } else {
            return -1;
        }
    });

    for (var j = 0; j < sorted.length; j++) {
        console.log(sorted[j]);
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n/));