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

