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

int main(void){
  int i, n;
  int *a;
  
  scanf("%d", &n);
  a = (int *)malloc(n * sizeof(int));
  
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

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