#include <stdio.h>
int main(void){
    int *array;
    int n,i;
    
    scanf("%d",&n);
    n+=1;
    array = (int *)malloc(n * sizeof(int));
    for(i = 1; i < n; i++){
        scanf("%d",&array[i]);
    }
    for(i = 1; i < n; i++){
        printf("node %d: key = %d, ",i,array[i]);
        if(i/2<n && i/2>0){
            printf("parent key = %d, ",array[i/2]);
        }
        if(2*i > 0 && 2*i <n){
            printf("left key = %d, ",array[2*i]);
        }
        if(2 * i + 1 > 0 && 2 * i + 1 <= n){
            printf("right key = %d, ",array[2*i + 1]);
        }
        printf("\n");
    }
    return 0;
}