#include <stdio.h>
#include <stdlib.h>
#define INF 2000000001

int parent_key(int);
int left_key(int);
int right_key(int);

int *A;
int n;

int main(){
        int i, p, l, r;

        scanf("%d", &n);

        A = malloc(n * sizeof(int) + 1);

        for(i = 1 ; i <= n ; i++){
                scanf("%d", &A[i]);
        }

        for(i = 1 ; i <= n ; i++){
                printf("node %d: key = %d, ", i, A[i]);
                p = parent_key(i);
                if(p != INF)printf("parent key = %d, ", p);
                l = left_key(i);
                if(l != INF)printf("left key = %d, ", l);
                r = right_key(i);
                if(r != INF)printf("right key = %d, ", r);
                printf("\n");
        }

        return 0;
}

int parent_key(int i){
        if(i/2 < 1 || n < i/2)return INF;
        return A[i / 2];
}

int left_key(int i){
        if(n < i*2)return INF;
        return A[2 * i];
}

int right_key(int i){
        if(n < (i*2+1))return INF;
        return A[2 * i + 1];
}

