#include <stdio.h>
 
int parentNode(int index);
int leftChild(int index);
int rightChild(int index);
 
int nodes[251];
 
main(){
 
    int i, n;
 
    scanf("%d", &n);
 
    for(i=1; i<=n; i++){
        scanf("%d", &nodes[i]);
    }
     
    for(i=1; i<=n; i++){
        printf("node %d: ", i);
        printf("key = %d, ", nodes[i]);
        if(parentNode(i-i%2) > 0)
            printf("parent key = %d, ", nodes[parentNode(i-i%2)]);
        if(leftChild(i) <= n)
            printf("left key = %d, ", nodes[leftChild(i)]);
        if(rightChild(i) <= n)
            printf("right key = %d, ", nodes[rightChild(i)]);
        printf("\n");
    }
     
    return 0;
     
}
 
int parentNode(int i){
    return (int)i/2;
}
 
int leftChild(int i){
    return 2*i;
}
 
int rightChild(int i){
    return 2*i+1;
}