#include <stdio.h>
#include <math.h>

#define N 252

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

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

  for( i = 1 ; i <= n; i++){
    printf("node %d: key = %d, " ,i ,a[i]);
    ix = parent(i);
    if( ix >= 1 && ix <= n ){     
      printf( "parent key = %d, " ,a[ix] );
    }
    ix = left(i);
    if( ix >= 1 && ix <= n ){
      printf( "left key = %d, " ,a[ix] );
    }
    ix = right(i);
    if(  ix >= 1 && ix <= n ){
      printf( "right key = %d, " ,a[ix] );
    }
    printf("\n");
  }

  return 0; // Don't forget return 0
}

int parent(int i){
  return floor(i/2);
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i + 1;
}