#include<stdio.h>

#define H 251

int main(void){
  int n,Node[H];
  int i;

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

  for(i = 1; i < n+1; i++){
    printf("node %d: key = %d, ",i,Node[i]);
    if(i/2 >= 1) printf("parent key = %d, ",Node[i/2]);
    if(2*i <= n) printf("left key = %d, ",Node[2*i]);
    if(2*i+1 <= n) printf("right key = %d, ",Node[2*i+1]);
    printf("\n");
  }
  
  return 0;
}

