#include<stdio.h>
#define N 100000

int parent(int i){return i/2;}
int left(int i){return 2*i;}
int right(int i){return 2*i+1;}

int main(){
    int Htw,i,Atw[N+1];

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

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

    return 0;
}
