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

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