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

int main(){
   int H, i, array;

    scanf("%d", &H);
    array = (int*)malloc(sizeof(array));

    for(i=0; i < H; i++){
        scanf("%d", &array[i]);
    }

    for(i = 1; i <= H; i++){
        printf("node %d:", i);
        printf(" key = %d,", array[i-1]);
        if(i/2 > 0) printf(" parent key = %d,", array[i/2]);
        if(2*i < H) printf(" left key = %d,", array[2*i]);
        if(2*i - 1 < H) printf(" right key = %d,", array[2*i - 1]);
    }
    free(array);
    return 0;
}