#include <iostream>
#include <cstdlib>
#include <vector>
#include <cstdio>
#include <ios>
#include <map>
#include <set>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <queue>
#include <cassert>
#include <cmath>
#include <string>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
vector< pi > v;
int assign(int cur, int l, int r){
if(l == r){
v.push_back(pi(-1, -1));
return v.size() - 1;
}
int mid = (l+r) >> 1;
int pos = v.size();
v.push_back(pi(-1, -1));
//int lIdx = assign(cur<<1, l, mid);
//int rIdx = assign((cur<<1) + 1, mid+1, r);
v[pos].first = assign(cur<<1, l, mid);
v[pos].second = assign((cur<<1) + 1, mid+1, r);
cout << v[pos].first << " " << v[pos].second << endl;
return pos;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("in.in", "r", stdin);
#endif
assign(1, 0, 10);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGxpYj4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGlvcz4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxjdGltZT4KI2luY2x1ZGUgPHF1ZXVlPgojaW5jbHVkZSA8Y2Fzc2VydD4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8c3RhY2s+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBwYWlyPGludCwgaW50PiBwaTsKCgp2ZWN0b3I8IHBpID4gdjsKCmludCBhc3NpZ24oaW50IGN1ciwgaW50IGwsIGludCByKXsKICAgIGlmKGwgPT0gcil7CiAgICAgICAgdi5wdXNoX2JhY2socGkoLTEsIC0xKSk7CiAgICAgICAgcmV0dXJuIHYu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