#include<stdio.h>
#define N -2000000001

int main(){
  int i,j,n;
  int A[251];

  scanf("%d",&n);
  for(i=0;i<=n;i++){
    A[i]=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] );

    if(i*2+1<=n&&A[i*2+1]!=N){
      printf("right key = %d , ",A[i*2+1] );}

    if(i*2<=n&&A[i*2]!=N){
      printf("left key = %d , ",A[i*2] );}

    if(A[i/2]!=N){
      printf("node %d : key = %d , ",A[i*2+1] );}

    printf("\n");
  }
  return 0;
}