#include<cstdio>
int n,f,l;
struct node{
	int rating,id;
}a[65537];
inline int read() {
	int ln=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {
		ln=(ln<<3)+(ln<<1)+ch-'0';
		ch=getchar();
	}
	return ln;
}
int main() {
	l=1,f=2;
	n=(1<<read());
	for(int i=1;i<=n;i++) {
		a[i].rating=read();
		a[i].id=i;
	}
	while(f<n) {
		for(int i=1;i<=n;i+=f) {
			if(a[i].rating<a[i+l].rating) a[i]=a[i+l];
		}
		f<<=1;
		l<<=1;
	}
	if(a[1].rating<a[1+l].rating) printf("%d",a[1].id);
	else printf("%d",a[1+l].id);
	return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T>bool chmin(T& x,const T&y) {if(x>y){x=y;return true;} else return false;}
template<typename T>bool chmax(T& x,const T&y) {if(x<y){x=y;return true;} else return false;}

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cout << (i*2) % N + 1 << ' ' << (i*2+1) % N + 1 << '\n';
    }
    return 0;
    // 重複, 境界, 条件, ll (1e5のnCr), 0, -, 1i, for s&g, debug
}