#include<stdio.h>
#define MAX 250

int main(){
    int key[MAX];
    int n,i;

    scanf("%d",&n);

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

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

        return 0;
}