#include<stdio.h>
#include <unistd.h>
#include <stdlib.h>

int main(){
  int i,n,a[250];
  scanf("%d",&n);
  for(i=1;i<n+1;i++){
    scanf("%d",&a[i]);

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

  }
  


}

