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

int main() {
  int *A, H, id, k, pk, lk, rk;

  scanf( "%d" , &H );
  A = malloc((H+1) * sizeof(int));
  for ( id=1; id<=H; id++ ) scanf( "%d" , &A[id] );

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

