#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node
{
int l,r,val;
node()
{
l=r=val=0;
}
};
vector<node> v(1);
int build(int s,int e)
{
int p=v.size();
v.push_back(node());
if(s==e)
return p;
int mid=(s+e)/2;
v[p].l=build(s,mid);
v[p].r=build(mid+1,e);
return p;
}
int main()
{
const int n = 100000 ;
int r=build(1,n);
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCnN0cnVjdCBub2RlCnsKICAgIGludCBsLHIsdmFsOwogICAgbm9kZSgpCiAgICB7CiAgICAgICAgbD1yPXZhbD0wOwogICAgfQp9OwoKdmVjdG9yPG5vZGU+IHYoMSk7CgppbnQgYnVpbGQoaW50IHMsaW50IGUpCnsKICAgIGludCBwPXYuc2l6ZSgpOwogICAgdi5wdXNoX2JhY2sobm9kZSgpKTsKICAgIGlmKHM9PWUpCiAgICAgICAgcmV0dXJuIHA7CiAgICBpbnQgbWlkPShzK2UpLzI7CiAgICB2W3BdLmw9YnVpbGQocyxtaWQpOwogICAgdltwXS5yPWJ1aWxkKG1pZCsxLGUpOwogICAgcmV0dXJuIHA7Cn0KCgppbnQgbWFpbigpCnsKICAgIGNvbnN0IGludCBuID0gMTAwMDAwIDsKICAgIGludCByPWJ1aWxkKDEsbik7CiAgICByZXR1cm4gMDsKfQo=