#include<stdio.h>
int parent(int);
int left(int);
int right(int);


int main(){
  int n, i, x;
  int a[250];
  scanf("%d", &n);

  for ( i = 1; i < n+1; i++ ){
    scanf("%d", &a[i]);
  }

  if(n==1)printf("node 1: key = %d, \n",a[1]);
  else  if(n==2)printf("node 1: key = %d, left key = %d, \n",a[1],a[2]);
 else{
 printf("node 1: key = %d, left key = %d, right key = %d, \n",a[1],a[2],a[3]);
    
 for ( i = 2; i < n+1; i++ ){
   printf("node %d: key = %d, parent key = %d, ",i,a[i],a[parent(i)]);
   if(n>=2*i){
     printf("left key = %d, ",a[left(i)]);
   }
   if(n>=2*i+1){
     printf("rigft key = %d, ",a[right(i)]);
   }
   printf("\n");
 }
 }
  return 0;
}

int parent(a){
  return a/2;
}
int left(a){
  return 2*a;
}
int right(a){
  return 2*a+1;
}