#include <stdio.h>
#include <stdlib.h>
long heap[251];
int main(){
    int n,a,tmp;
    while(scanf("%d",&n)!=EOF){
        for(a=1;a<=n;a++){
            scanf("%d",&heap[a]);
        }
        for(a=1;a<=n;a++){
            printf("node %d: ",a);
            printf("key = %d, ",heap[a]);
            if(a!=1){
                if(a%2){
                    tmp=(a-1)/2;
                }
                printf("parent key = %d, ",heap[tmp]);
            }
            if(!(a*2>n)){
                tmp=2*a;
                printf("left key = %d, ",heap[tmp]);
            }
            if(!(a*2>n)){
                tmp=2*a;
                tmp+=1;
                printf("right key = %d,",heap[tmp]);
            }
            printf("\n");
        }
    }
    return 0;
}

