#include<stdio.h>
#define H 250

int main(){
  int x,a,b,c,i,A[H];

  scanf("%d",&x);

  for(i=0;i<x;i++){
    scanf("%d",&A[i]);
  }


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

  return 0;
}