#include <stdio.h>
#define N 251
void sum(int);
void num(int);
void tum(int);
int n;
int rum[N];
int main(){
    
    scanf("%d",&n);
    int i;
    
    for(i=1;i<=n;i++)scanf("%d",&rum[i]);
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,rum[i]);
        sum(i);
        num(i);
        tum(i);
        printf("\n");
    }
    return 0;
}

void sum(int i){
    int b=i/2;
    if(b>=1)
    {
        printf("parent key = %d, ",rum[b]);
    }
}
void num(int i){
    if(2*i<=n)
    {
        printf("left key = %d, ",rum[2*i]);
        
    }
}
void tum(int i){
    if(2*i+1<=n){
        printf("right key = %d, ",rum[2*i+1]);
        
    }
}        

  

