/// Marius Nicoli, de la dreapta la stanga, cu vector
#include <fstream>

using namespace std;
int v[100010];
int w[100010];
long long n, i, impare, dif, sumaCurenta, sumaAnterioara;
long long poz, minim = 100000000000001LL;
int main () {
    ifstream fin("tri.in");
    ofstream fout("tri.out");
    fin>>n;
    for (i=1;i<=n;i++)
        fin>>v[i];
    for (i=n;i>=1;i--) {
        if (v[i]%2 != 0) {
            impare++;
            w[impare] = i;
            if (impare >= 3) {
                dif = sumaCurenta-sumaAnterioara;
                if (dif < 0)
                    dif = -dif;
                if (dif < minim) {
                    minim = dif;
                    poz = impare;
                }
            }
            sumaAnterioara = sumaCurenta;
            sumaCurenta = 0;
        } else
            sumaCurenta += v[i];
    }
    fout<<w[poz]<<" "<<w[poz-2];
    return 0;
}
