#include<stdio.h>
#include<stdlib.h>
#define h 250

int main(){
  int H,i;
  int A[h];

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

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