#include<stdio.h>
#include<stdlib.h>
int main(){
  int n, i,p,l,r;
  scanf("%d", &n);
  int a[n];
  for ( i = 1; i <= n; i++ ){
    scanf("%d",&a[i]);
    //printf("%d",a[i]);
  }
  for(i=1;i<=n;i++){
    p=i/2;
    l=2*i;
    r=2*i+1;
    printf("node %d: key = %d, ",i,a[i]);
    if(i!=1){
      printf("parent key = %d, ",a[p]);
    }
    if(l<=n){
      printf("left key = %d, ",a[l]);
    }
    if(r<=n){
      printf("right key = %d, ",a[r]);
    }
    printf("\n");
  }
  return 0;
}
