/* 
sursa Raluca Costineanu 
*/
#include <fstream> 
#include <iostream> 
using namespace std; 
  
ifstream f("tri.in"); 
ofstream g("tri.out"); 
long long sumPar1, sumPar2, mn=(1<<30), dif; 
int start, fin; 
int main() 
{ 
    int x, n, i, cateImpare = 0, poz1Imp = 0, poz2Imp = 0, poz3Imp = 0; 
    f>>n; 
    for(i=1; i<=n; i++) 
    { 
        f>>x; 
        if(x%2) 
        { 
            cateImpare++; 
            if(cateImpare == 1) poz1Imp = i; 
            else if(cateImpare == 2)poz2Imp = i; 
            else poz3Imp = i; 
        } 
        else if(cateImpare == 1) 
            start=i-1, sumPar1 += x; 
        else if(cateImpare == 2) 
            sumPar2 += x; 
        if(cateImpare > 2) 
            break; 
    } 
    start = poz1Imp; 
    fin = poz3Imp; 
    if(sumPar1 > sumPar2) mn = sumPar1 - sumPar2; 
    else mn = sumPar2 - sumPar1; 
    //g << sumPar1 << ' ' << sumPar2 << ' '<<poz1Imp<< ' ' << poz3Imp<<'\n'; 
    poz1Imp = poz2Imp; 
    poz2Imp = poz3Imp; 
    sumPar1 = sumPar2; 
    sumPar2 = 0; 
    for(i++; i<=n; i++) 
    { 
        f>>x; 
        if(x%2==0) sumPar2 += x; 
        else
        { 
            poz3Imp = i; 
            if(sumPar1 > sumPar2) dif = sumPar1 - sumPar2; 
            else dif = sumPar2 - sumPar1; 
            if(dif <= mn) 
                mn = dif, start = poz1Imp, fin = poz3Imp; 
            //g << sumPar1 << ' ' << sumPar2 << ' '<<poz1Imp<<' '<<poz3Imp<<'\n'; 
            poz1Imp = poz2Imp; 
            poz2Imp = poz3Imp; 
            sumPar1 = sumPar2; 
            sumPar2 = 0; 
        } 
    } 
    g << start <<' '<< fin; 
    return 0; 
} 