#include <stdio.h>
#include <stdlib.h>

int main(){
  int n,i;
  int *node;

  scanf("%d",&n);
  node = malloc((n + 1) * sizeof(int));
  for(i=1;i<n+1;i++)
    scanf("%d",&node[i]);

  for(i=1;i<n+1;i++){
    
    printf("node: %d: key = %d, ",i,node[i]);

    if(1 <= i/2)  printf("parent key = %d, ",node[i/2]);

    if(i * 2 <= n)  printf("left key = %d, ",node[2*i]);

    if(i * 2 + 1 <= n)  printf("right key = %d, ",node[2*i +1]);
  
    printf("\n");
  }
  return 0;
}