#include<stdio.h>

int main(){
  int H,i,j,k,l,A[250],left = 0,right = 0,parent = 0;
  
  scanf("%d",&H);
  
  for(i = 1;i <= H ;i++){
    scanf("%d",&A[i]);
  }
  
  for(i = 1;i <= H;i++){
    j = 2*i;
    k = 2*i+1;
    l = i/2;
    left = A[j];
    right = A[k];
    parent = A[l];
    if(j > H){
      left = 0;
    }
    if(k > H){
      right = 0;
    }
    if(l < 1){
      parent = 0;
    }
    printf("node %d: key = %d, ",i,A[i]);
    if(parent != 0){
      printf("parent key = %d, ",parent);
    }
    if(left != 0){
      printf("left key = %d, ",left);
    }
    if(right != 0){
      printf("right key = %d, ",right);
    }
    printf("\n");
  }
      return 0;
}
  

