#include <stdio.h>

typedef struct node{
  int id;
  int key;
}NODE;

int main(){

  NODE heap[250];
  int i, n;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&heap[i].key);
    heap[i].id = i;
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d,",heap[i].id,heap[i].key);
 
    if(i!=1) printf(" parent key = %d,",heap[i/2].key);
  
    if(2*i<=n) printf(" left key = %d ,",heap[2*i].key);
    if(2*i+1<=n) printf(" right key = %d ,",heap[2*i+1].key);
    printf("\n");
  }

  return 0;
}