#include<stdio.h>
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
    }

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