#include<stdio.h>
#define N 250

typedef struct{
  int left;
  int right;
  int key[N];
} Heap;

int main(){
  int size,i;
  Heap value;
  for(i=0 ; i<N ; i++){
    value.key[i] = NULL;
  }
  scanf("%d",&size);
  for(i=0 ; i<size ; i++){
    scanf("%d",&value.key[i]);
  }
  for(i=0 ; i<size ; i++){
    printf("node %d: ",i+1);
    printf("key = %d, ",value.key[i]);
    if(i%2==1){
      if(i>0)printf("parent key = %d, ",value.key[i/2]);
    }
    else{
      if(i>0)printf("parent key = %d, ",value.key[i/2-1]);
    }
      if(value.key[2*i+1] != NULL) printf("left key = %d, ",value.key[2*i+1]);
      if(value.key[2*i+2] != NULL) printf("right key = %d, ",value.key[2*i+2]);
    printf("\n");
  }
  
  return 0;
}

