#include<stdio.h>
#include<stdlib.h>
#define MAX 255

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[MAX],i,size,left,right;

  scanf("%d",&size);
  for(i=1 ; i<=size ; i++){
    scanf("%d",&heap[i]);
  }

  for(i=1 ; i<=size ; i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(i>=2) printf("parent key = %d, ",heap[Parent(i)]);

    left=Left(i);
    right=Right(i);
    if(left<=size) printf("left key = %d, ",heap[left]);
    if(right<=size) printf("right key = %d, ",heap[right]);

    printf("\n");
  }
  return 0;
}