#include <stdio.h>
#define H 250

int main(){
  int h,i;
  int data[H];

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

  for(i = 1;i < h+1;i++){
    printf("node %d: key = %d, ",i,data[i]);
    if(i != 1 && 1 <= i/2 && i/2 < h+1) printf("parent key = %d, ",data[i/2]);
    if(1 <= 2*i && 2*i < h+1) printf("left key = %d, ",data[2*i]);
    if(1 <= (2*i+1) && (2*i+1) < h+1) printf("right key = %d, ",data[2*i+1]);
    printf("\n");
  }
  
  return 0;
}

