#include<stdio.h>
#define MAX 300

int main(){

    int A[MAX];
    int i,h,k,pk,lk,rk;

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

    for(i=1;i<=h;i++){
        k=A[i];
        pk=A[i/2];
        lk=A[i*2];
        rk=A[i*2+1];
        if(i>1) printf("\n");
        printf("node %d: key = %d, ",i,A[i]);
        if(i/2 > 0){
        printf("parent key = %d, ",pk);
        }
        if(h >= i*2){
            printf("left key = %d, ",lk);
        }
        if(h >= i*2+1){
            printf("right key = %d, ",rk);
        }
    }
    printf("\n");
    return 0;
}
