#include<stdio.h>
#define H 252
int main(){
  int i,n,T[H];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&T[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d,",i,T[i]);
    if(i==1){
      printf("left key = %d, right key = %d,\n",T[2*i],T[2*i+1]);
    }
    else if(2*i<=n){
      printf("parent key = %d, left key = %d, right key = %d,\n",T[i/2],T[2*i],T[2*i+1]);
    }
    else{
      printf("parent key = %d,\n",T[i/2]);
    }
  }
  return 0;
}

