#include <stdio.h>
#define MAX_LENGTH 10000
#define NIL -2
int main() {
    int num;
    int arr[MAX_LENGTH];
    for(int i=0;i!=MAX_LENGTH;i++){arr[i]=NIL;}
    scanf("%d", &num);
    for(int i = 1;i<num+1;i++)
    {
        scanf("%d", &arr[i]);
    }
    for(int j=1;j<num+1;j++)
    {
        printf("node %d: ", j);
        printf("key = %d, ", arr[j]);
        if(j!=1){printf("parent key = %d, ", arr[j/2]);}
        if(arr[2*j]!=NIL){printf("left key = %d, ", arr[2*j]);}
        if(arr[2*j+1]!=NIL){printf("right key = %d, ", arr[2*j+1]);}
        printf("\n");
    }
    return 0;
}

