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

