#include <stdio.h>
int n;
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node  Node;

int main(){
    Node x[100];
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&x[i].key);
    }
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,x[i].key);
        if(i!=1){
            printf("parent key = %d, ",x[i/2].key);
        }
        if(2*i<=n){
            printf("left key = %d, ",x[i*2].key);
        }
        if(2*i+1<=n){
            printf("right key = %d, ",x[i*2+1].key);
        }
        printf("\n");
    }
    
return 0;
}
