#include <cstdint>
#include <iostream>
#include <istream>
#include <map>
#include <stdexcept>
#include <string>
#include <utility>
#include <variant>
#include <vector>

using ll =int64_t;
ll n,m,a,b;
std::vector<std::string> ans;
std::map<std::string, ll> ansm;

std::variant<std::string,std::monostate> findAnsFromNum(ll n){
    for(auto &s:ansm){
        if(s.second==n){
            return s.first;
        }
    }
    return std::monostate();
}

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    std::cin>>n>>m>>a>>b;
    ans.resize(n+1);
    for(ll i=1;i<=n;i++){
        std::string s;
        std::cin>>s;
        ansm[s]++;
        ans[i]=std::move(s);
    }
    auto findr = findAnsFromNum(a);
    if(std::string* ptr = std::get_if<std::string>(&findr)){
        std::cout<<*ptr<<'\n';//TODO 检查相反串及特殊情况
    }else{
        
    }
}