#include<stdio.h>
#define N 1000

int main(){
    int i,a,p,l,r,A[N];

    scanf("%d",&a);
    for(i = 1;i <= a;i++){
        scanf("%d",&A[i]);
    }

    for(i = 1;i <= a;i++){
        p = i/2;
        l = i*2;
        r = i*2+1;
        printf("node %d: ",i);
        printf("key = %d, ",A[i]);
        if(i != 1)printf("parent key = %d, ",A[p]);
        if(l <= a)printf("left key = %d, ",A[l]);
        if(r <= a)printf("right key = %d, ",A[r]);
        printf("\n");
    }
    return 0;
}
