#include<stdio.h>
#define H_size 250

int main(){
    int size,i;
    int H[H_size+1];
    scanf("%d",&size);

    for(i=1;i<=size;i++)  scanf("%d",&H[i]);

    for(i=1;i<=size;i++){
        printf("node %d: key %d ",i,H[i]);
        if(i != 1) printf("parent key = %d, ",H[i/2]);
        if(2*i <= size) printf("left key = %d, ",H[2*i]);
        if(2*i+1 <= size) printf("right key = %d",H[2*i+1]);
        puts("");
    }
    return 0;
}