#include<stdio.h>
#define NIL -2000000001
int main(){
  int i,n;
  int A[502];
  scanf("%d",&n);

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