#include<stdio.h>
#include<stdlib.h>

int main(){

  int i,H,*key;

  scanf("%d",&H);
  key=(int *)malloc(sizeof(int)*H);
  for(i=0;i<H;i++)scanf("%d",&key[i]);

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

  free(key);

  return 0;
}