#include<stdio.h>
#define N 250

int main(){
    int size,i,key[N];
    //for(i=0 ; i<N ; i++){
    key[1] = NULL;
    //}
    scanf("%d",&size);
    for(i=1 ; i<size+1 ; i++){
        scanf("%d",&key[i]);
    }
    for(i=1 ; i<size+1 ; i++)
    {
        printf("node %d: ",i);
        printf("key = %d, ",key[i]);
        if(i/2>0)printf("parent key = %d, ",key[i/2]);
        if(2*i <= size) printf("left key = %d, ",key[2*i]);
        if(2*i+1 <= size) printf("right key = %d, ",key[2*i+1]);
        printf("\n");
    }
    return 0;
}

