#include <stdio.h>
#include <stdlib.h>

int main(){
    int n,id;
    int *H;
    
    scanf("%d",&n);
    H = malloc(sizeof(int)*(n+1));
    
    for(id=1;id<=n;id++){
        scanf("%d",&H[id]);
    }
    
    for(id=1;id<=n;id++){
        printf("node %d: key = %d, ",id,H[id]);
        if(id/2>0){
            printf("parent key = %d, ",H[id/2]);
        }
        if(id*2<=n){
            printf("left key = %d, ",H[id*2]);
        }
        if(id*2+1<=n){
            printf("right key = %d, ",H[id*2+1]);
        }
        printf("\n");
    }
    
    return 0;
}

