#include <stdio.h>

main(){
  int i,A[251],h,n,p;

  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]);
    if(i/2 >= 1) printf("parent key = %d, ",A[i/2]);
    else if(2*i+1 > n) printf("\n");
    if(2*i+1 <= n) printf("left key = %d, right key = %d, \n",A[2*i],A[2*i+1]);
    else printf("\n");
  }
  return 0;
}