#include <stdio.h>

int parent(int);
int left(int);
int right(int);

int data[250];
int main(){
  int H;
  int i;
  scanf("%d",&H);
  for(i=1;i<=H;i++)
    scanf("%d",&data[i]);
  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,data[i]);
    if(i/2!=0) printf("parent key = %d, ",parent(i));
    if(i*2<=H) printf("left key = %d, ",left(i));
    if(i*2+1<=H) printf("right key = %d, ",right(i));

    printf("\n");
    }
  return 0;
}

int parent(int i){
  return data[i/2];
}

int left(int i){
  return data[2*i];
}

int right(int i){
  return data[2*i+1];
}

