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

int main(){

  int *a;
  int n,i,j;

  scanf("%d",&n);
  a = malloc(sizeof(int)*(n+1));

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

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

  free(a);

  return 0;
}