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