#include<stdio.h>
#define M 251

int main(){
  int i,h,heap[M];
  scanf("%d",&h);
  for(i=1;i<=h;i++)
    scanf("%d",&heap[i]);
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(i/2) printf("parent key = %d, ",heap[i/2]);
    if(2*i<=h) printf("left key = %d, ",heap[2*i]);
    if(2*i+1<=h) printf("right key = %d, ",heap[2*i+1]);
    printf("\n");
  }
  return 0;
}

