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]]++;
        } else {
            counter[S[i]] = 1;
        }
    }

    var array = Object.keys(counter).map((c)=>({ key: c, value: counter[c] }));
    var sorted = array.sort((a, b) => {
        if (a.value === b.value) {
            if (a.key > b.key) {
                return 1;
            } else {
                return -1;
            }
        } else {
            return b.value - a.value;
        }
    });
    
    var max = sorted[0].value;

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

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