#include <stdio.h>
#define N 100000
 
int main() {
   
  int i,n,A[N];
  int parent,left,right;
   
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    scanf("%d",&A[i]);
   
  for(i=1;i<=n;i++) {
    parent = i/2;
    left = 2*i;
    right = 2*i+1;
     
    printf("node %d: key = %d, ",i,A[i]); 
    if(i != 1)
      printf("parent key = %d, ",A[parent]);
     
    if(left <= n)
      printf("left key = %d, ",A[left]);
     
    if(right <= n)
      printf("right key = %d, ",A[right]); 
     
    printf("\n");
  }
  return 0;
}