#include <stdio.h>

#define M 10000
#define parent(i) (i/2)
#define right(i) (2*i+1)
#define left(i) (2*i)

int A[M];

int main(){
  int num;
  int i;
  
  scanf("%d",&num);
  for(i=1;i<=num;i++) scanf("%d",&A[i]);

  for(i=1;i<=num;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(A[parent(i)]!=0) printf("parent key = %d, ",A[parent(i)]);
    if(A[left(i)]!=0) printf("left key = %d, ",A[left(i)]);
    if(A[right(i)]!=0) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  
  return 0;
}

