#include<stdio.h>

#define MAX 250

int main(){
  int A[MAX+1];
  int i,heap;

  scanf("%d",&heap);
  for(i=1;i<=heap;i++) scanf("%d",&A[i]);

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

  return 0;
}

