#ifndef __CODE_H__
#define __CODE_H__

#include<vector>
#include <climits>
std::pair<int,int> *maxhor, *minvert;
int Pitaj(int i, int j);
std::vector<int> Nadji(int N, int K)
{
    using namespace std;
    vector<int> res;
    maxhor = new pair<int,int>[N+1];
    minvert = new pair<int,int>[N+1];
    for(int i = 1; i <= n; i++)
    {
        maxhor[i].first = 0;
        minvert[i].first = INT_MAX;
    }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
        {
            int t = Pitaj(i, j);
            if(maxhor[i].first < t)
            {
                maxhor[i].first = t;
                maxhor[i].second = j;
            }
            if(minvert[j].first > t)
            {
                minvert[j].first = t;
                minvert[j].second = i;
            }
        }
    for(int i = 1; i <= n; i++)
        if(i == maxhor[minvert[i].second].second)
        {
            res.push_back(minvert[i].second);
            res.push_back(i);
            return res;
        }

    res.push_back(0);
    res.push_back(0);
    return res;

}


#endif /* __CODE_H__ */