第(i)次位置在(pos_0 / 2^{i - 1})
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define R(a,b,c) for(register int a = (b); a <= (c); ++ a)
#define nR(a,b,c) for(register int a = (b); a >= (c); -- a)
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Fill(a,b) memset(a, b, sizeof(a))
#define Abs(a) ((a) < 0 ? -(a) : (a))
#define Swap(a,b) a^=b^=a^=b
#define ll long long
#define ON_DEBUG
#ifdef ON_DEBUG
#define D_e_Line printf("
----------
")
#define D_e(x) cout << #x << " = " << x << endl
#define Pause() system("pause")
#define FileOpen() freopen("in.txt","r",stdin);
#else
#define D_e_Line ;
#define D_e(x) ;
#define Pause() ;
#define FileOpen() ;
#endif
struct ios{
template<typename ATP>ios& operator >> (ATP &x){
x = 0; int f = 1; char c;
for(c = getchar(); c < '0' || c > '9'; c = getchar()) if(c == '-') f = -1;
while(c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
x*= f;
return *this;
}
}io;
using namespace std;
double f[11][2027];
int won[2027][2027];
int main(){
int n;
io >> n;
int m = 1 << n;
R(i,1,m){
R(j,1,m){
io >> won[i][j];
}
}
R(i,1,m){
f[0][i] = 1;
}
R(i,1,n){
R(j,1,m){
int pos = ceil((double)j / (double)(1 << (i - 1)));
pos = (pos & 1) ? pos + 1 : pos - 1;
R(k, pos * (1 << (i - 1)) - (1 << (i - 1)) + 1, pos * (1 << (i - 1))) {
f[i][j] += f[i - 1][j] * won[j][k] / 100 * f[i - 1][k];
}
}
}
double maxx = 0.0;
int ans;
R(i,1,m){
if(f[n][i] > maxx){
maxx = f[n][i];
ans = i;
}
}
printf("%d", ans);
return 0;
}