#include <stdio.h>
#define MAX 250

int Parent(int i){

  return(i/2);
}


int Left(int i){

  return 2*i;
}

int Right(int i){

  return 2*i+1;
}

main(){
  int heap_size;
  int A[MAX];
  int i;


  scanf("%d",&heap_size);

  for(i=1;i <= heap_size;i++){

    scanf("%d",&A[i]);

  }

  for(i=1;i <= heap_size;i++){

    
    printf(" node %d: key = %d,",i,A[i]);

    if(Parent(i) >= 1){
      printf(" parent key = %d,",A[Parent(i)]);
    }

	if(Left(i) <= heap_size){

	  printf(" left key = %d,",A[Left(i)]);
	}

      if(Right(i) <= heap_size){

	printf(" right key = %d,",A[Right(i)]);
      }
      printf("\n");
  }
  return 0;
}