#include<stdio.h>

#define MAX 250

void print(int);

int H[MAX]; 

int main(){
  int i,h;
  scanf("%d",&h);
  for(i=1;i<=h;i++){
    scanf("%d",&H[i]);
  }
  print(h);
  return 0;
}

void print(int h){
  int i;
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,H[i]);
    if(i/2!=0){
      printf("parent key = %d, ",H[i/2]);
    }
    if(i*2<=h){
      printf("left key = %d, ",H[i*2]);
    }
    if(i*2+1<=h){
      printf("right key = %d, ",H[i*2+1]);
    }
    printf("\n");
  }
}
  

  

