#include "minecraft.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> portals(int N, int K)
{
    return {};
}

pair<int, int> minimal_danger(int N, vector<pair<int, pair<int, int>>> paths, vector<int> portals, vector<int> fortresses)
{
    return {0, 0};
}

pair<int, int> find_end_portal(int L)
{
    int l1=1,r1=L,l2=1,r2=L,mid1,mid2;
    string s;
    int ot1=0,ot2=0;
    while(l1<=r1)
    {
        mid1=(l1+r1)/2;
        mid2=(l2+r2)/2;
        /*if(l1==r1)
        {
            ot1=l1;
            ot2=l2;
            return {ot1,ot2};
        }*/
        s=throw_eye({mid1,mid2});
        if(s=="NONE")
        {
            ot1=mid1;
            ot2=mid2;
            return {ot1,ot2};
        }
        if(s=="N"||s=="S")
        {
            ot1=mid1;
            if(s=="N")l2=mid2+1;
            else r2=mid2-1;
        }
        if(s=="E"||s=="W")
        {
            ot2=mid2;
            if(s=="E")l1=mid1+1;
            else r1=mid1-1;
        }
        if(s=="NE")
        {
            l2=mid2+1;
            l1=mid1+1;
        }
        if(s=="NW")
        {
            l2=mid2+1;
            r1=mid1-1;
        }
        if(s=="SW")
        {
            r2=mid2-1;
            r1=mid1-1;
        }
        if(s=="SE")
        {
            r2=mid2-1;
            l1=mid1+1;
        }
    }
    return {ot1,ot2};
}
