#include<stdio.h>
#define H 2000000

int main(){
  int id,A[H],x;

  scanf("%d",&x);
  for(id = 1;id <= x;id++){
    scanf("%d",&A[id]);
  }

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