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

