#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
int A[250];
void parent(int pk){
  if((pk/2)>0){
    printf("parent key = %d, ",A[pk/2]);
  }
}
void left(int lk){
  if(A[lk*2]!=NIL){
    printf("left key = %d, ",A[lk*2]);
  }
}
void right(int rk){
  if(A[rk*2+1]!=NIL){
    printf("right key = %d, ",A[rk*2+1]);
  }
}
int main(){
  int h, i, j;

  scanf("%d", &h);

  for ( i = 1; i <= h; i++ ){
    scanf("%d", &A[i]);
  }
  for ( j = 1; j <= h; j++ ){
    printf("node %d: key = %d, ",j,A[j]);
    parent(j);
    left(j);
    right(j);
    printf("\n"); 
  }
  return 0;
}

