#include <stdio.h>
#define MAX 251

int main(){
  int n, i;
  int array[MAX];

  scanf("%d", &n);

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

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