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