#include<stdio.h>

#define MAX 250

void Max_Heapify(int);

int main(){
int i, size;
int T[MAX];

  scanf("%d",&size);

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

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


