#include <stdio.h>
#define MAX 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 CompBT[MAX];
    int i,n;
    
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&CompBT[i]);
    }
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,CompBT[i]);
        if(Parent(i)>=1) printf("parent key = %d, ",CompBT[Parent(i)]);
        if(Left(i)<=n) printf("left key = %d, ",CompBT[Left(i)]);
        if(Right(i)<=n) printf("right key = %d, ",CompBT[Right(i)]);
        printf("\n");
    }
    return 0;
}