#include <stdio.h>
#include <stdlib.h>
#define N 250 

int main(){
  int arr[N+1],n,data,i,node=1;

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

