#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;
}
 
int main(){
 
  int i,n,p,l,r;
  int A[250];
  
  scanf("%d",&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]);
 
      p = parent(i);
 
      if(p != 0)
	{
	  printf("parent key = %d, ",A[p]);
	}
 
      l = left(i);
 
      if(l <= n)
	{
	  printf("left key = %d, ",A[l]);
	}
 
      r = right(i);
 
      if(r <= n)
	{
	  printf("right key = %d, ",A[r]);
	}
 
      printf("\n");
    }
  return 0;
}