#include <stdio.h>

int main(){
  int h,i,A[250],j,pk,lk,rk;
  scanf("%d",&h);
  for (i = 1; i <= h;i++){
    scanf("%d",&A[i]);  
  }


  for (i = 1; i <= h; i++){
    printf("node %d: ",i);
    printf("key = %d, ",A[i]);
    pk = A[i/2];
    lk = A[2*i];
    rk = A[2*i+1];
  
    if(i != 1){
      printf("parent key = %d, ",pk);
    }   
    if(2*i <=  h){ 
      printf("left key = %d, ",lk);
    }
    if(2*i+1 <= h){     
      printf("right key = %d, ",rk);
    }
    printf("\n");
  }




  return 0;

}