#include <stdio.h>//?????¨????????¨
#define H 250
int main() {
  int A[H];
  int count, i;

  scanf("%d",&count);
  for( i=1 ; i<=count ; i++ ) scanf("%d", &A[i]);
  for( i=1 ; i<=count ; i++ ){
    printf("node %d: key = %d, ", i, A[i]);
    if( i!=1 && i%2==0 ) printf("parent key = %d, ", A[i/2]);
    if( i!=1 && i%2==1 ) printf("parent key = %d, ", A[(i-1)/2]);
    if( i*2-1 < count ) printf("left key = %d, ", A[i*2]);
    if( i*2 < count ) printf("right key = %d, ", A[i*2+1]);
    printf("\n");
  }

  return 0;
}