#include<stdio.h>

int main(){
  int n,i;
  int T[251*2+1];

  for(i = 1;i <= 250*2+1;i++) T[i] = -2000000001;

  scanf("%d",&n);

  for(i = 1;i <= n;i++) scanf("%d",&T[i]);

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

      if(T[i*2+1] == -2000000001){
	printf("\n");
	continue;
      }
      else printf("right key = %d, \n",T[i*2+1]);
    }
  }
  return 0;
}

