#include<stdio.h>
#define MAX 300000

int parent(int a){
  return a/2;
}

int left(int a){
  return 2*a;
}

int right(int a){
  return (2*a)+1;
}

int main(int argc, const char * argv[]){
  int a,i;
  int b[MAX+1];

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

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

