#include<stdio.h>

int tree[500000];
int size;

int main(){
    scanf("%d", &size);
    for(int i=0; i<size; i++) {
        int tmp;
        scanf("%d", &tmp);
        tree[i] = tmp;
    }

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