#include <stdio.h>
#define MAX 100000

int parent (int);
int left (int);
int right (int);

int main(void){
    int K,i,M[MAX+1];
    scanf("%d",&K);
    for(i=1;i<=K;i++)
        scanf("%d",&M[i]);
    for(i=1;i<=K;i++){
        printf("node %d: key = %d, ",i,M[i]);
        if(parent(i) >= 1)
            printf("parent key = %d, ",M[parent(i)]);
        if(left(i) <= K)
            printf("left key = %d, ",M[left(i)]);
        if(right(i) <= K)
            printf("right key = %d, ",M[right(i)]);
        puts("");
    }
    return 0;
}

int parent (int i){ return i/2; }

int left(int i){ return 2*i; }

int right(int i){ return 2*i+1; }
