#include<stdio.h>
#define N 250



int main(){
  int i,n,j,a;
  int A[N];

  scanf("%d",&n);

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

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

