#include<stdio.h>

int main(){
  int A[251], H, i;

  scanf("%d", &H);
  if(H <= 250){
    for(i = 1; i < H+1; i++){
      scanf("%d", &A[i]);
    }

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

