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

int array[251];

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