#include <stdio.h>

int main(){
  int size,i;
  int key[251];

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

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

  return 0;
}
			

