#include <stdio.h>
#define heap_size 251

int Parent(int);
int Left(int);
int Right(int);

main(){
  
  int i,n,A[heap_size],left,right;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i>1)
      printf("parent key = %d, ",A[Parent(i)]);
    left=Left(i);
    right=Right(i);
    if(left<=n)
      printf("left key = %d, ",A[left]);
    if(right<=n)
      printf("right key = %d, ",A[right]);
    printf("\n"); 
  }
  return 0;
}

int Parent(int i){
  return i/2;
}

int Left(int i){
  return 2*i;
}

int Right(int i){
  return 2*i+1;
}