#include <stdio.h>

int main(){
  int n,i,c;
  long int a[500];

  for(i=0;i<500;i++)a[i]='\0';

  scanf("%d",&n);

  for(i=1;i<=n;i++)
    scanf("%ld",&a[i]);

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

    //c = i * 2 + 1;
    if(a[i*2+1] != '\0')printf("right key = %ld, ",a[i*2+1]);
    printf("\n");
  }
  
  return 0;
}

