#include <stdio.h>

#define M 250

int main(){
  int hp,i,tree[M+1];

  scanf("%d",&hp);
  for(i=1;i<=hp;i++){
    scanf("%d",&tree[i]);
  }

    for(i=1;i<=hp;i++){
      printf("node %d: key = %d, ",i,tree[i]);
      if(i/2>=1) printf("parent key = %d, ",tree[i/2]);

      if(i*2<=hp) printf("left key = %d, ",tree[i*2]);
      if(i*2+1<=hp) printf("right key = %d, ",tree[i*2+1]);

      printf("\n");
    }
    return 0;
}

