#include<stdio.h>

#define MAX 251
#define NIL 2000000001

main(){
  int i,n,k[MAX];

  for(i=0;i<MAX;i++){
    k[i]=NIL;
  }
  scanf("%d",&n);

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

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,k[i]);
    
    if(k[i/2]!=NIL) printf("parent key = %d, ",k[i/2]);

    if(2*i<=n && k[2*i]!=NIL) printf("left key = %d, ",k[2*i]);
    
    if(2*i+1<=n && k[2*i+1]!=NIL) printf("right key = %d, ",k[2*i+1]);
    
    printf("\n");
  }

  return 0;
}