#include <stdio.h>
int main(){
  int num,i,array[251];
  scanf("%d",&num);
  for(i=1;i<=num;i++) scanf("%d",&array[i]);
  for(i=1;i<=num;i++){
    printf("node %d: key = %d, ",i,array[i]);
    if(i/2 >= 1) printf("parent key = %d, ",array[i/2]);
    if(2*i <= num) printf("left key = %d, ",array[2*i]);
    if(2*i+1 <=num) printf("right key = %d, ",array[2*i+1]);
    printf("\n");
  }
  return 0;
}
			    

