#include <stdio.h>
#include<stdlib.h>
int parent(int i){
  return i/2;
}

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

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

int main(){
  int H[251];
  int i,j,k,Hsiz;
  scanf("%d",&Hsiz);
  for(i=1;i<=Hsiz;i++){
    scanf("%d",&H[i]);
  }

  for(i=1;i<=Hsiz;i++){
    printf("node %d: key = %d, ",i,H[i]);
    if(parent(i)>=1 && parent(i)<=Hsiz){
      printf("parent key = %d, ",H[parent(i)]);
    }
if(left(i)>=1 && left(i)<=Hsiz){
  printf("left key = %d, ",H[left(i)]);
    }
 if(right(i)>=1 && right(i)<=Hsiz){
   printf("right key = %d, ",H[right(i)]);
    }
 printf("\n");
  }
  return 0;
}