#include<stdio.h>
#include<stdlib.h>
#define MAX 2000000000
#define HS 250

int main(void){
  int hs,i,j;
  int a[HS];

  scanf("%d",&hs);

  for(i=1; i<=hs; i++){
    scanf("%d",&a[i]);
    if(a[i]<-MAX || a[i]>MAX){
      printf("error");
      exit(1);
    }
  }

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