#include<stdio.h>
#define N 251
int A[N];
int main(){
  int total,i;
  scanf("%d",&total);
  for(i=1;i<=total;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=total;i++){
    printf("node %d: ",i);
    printf("key = %d, ",A[i]);
    if(i!=1)printf("parent key = %d, ",A[i/2]);
    if(i*2<=total)printf("left key = %d, ",A[i*2]);
    if(i*2+1<=total)printf("right key = %d, ",A[i*2+1]);
    printf("\n");
  }
  return 0;
}


