#include<stdio.h>

int A[260];

void parent(int b){
  printf("parent key = %d, ",A[b/2]);
}

void left(int f){
  printf("left key = %d, ",A[f*2]);
}

void right(int s){
  printf("right key = %d, ",A[s*2+1]);
}



int main(){
  int H;
  int i;
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }

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

