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

void printTree(int,int[]);

int main(int argc, char** argv) {
    int size;
    scanf("%d",&size);
    int array[size];
    for(int i = 0; i < size; i++)
        scanf("%d",&array[i]);
    printTree(size,array);
    return (EXIT_SUCCESS);
}

void printTree(int size, int array[size]){
    for(int i = 0; i < size; i++){
        printf("node %d: ", i+1);
        printf("key = %d, ", array[i]);
        if(i > 0)
            printf("parent key = %d, ", array[(i-1)/2]);
        if(2*i+1 < size)
            printf("left key = %d, ", array[2*i+1]);
        if(2*i+2 < size)
            printf("right key = %d, ", array[2*i+2]);
        printf("\n");
    }
}

