#include <stdio.h>
#define MAX 100000
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return (2*i)+1;
}

int main() {
  int num,Heap[MAX + 1],i;
  scanf("%d",&num);
  for(i=1;i<=num;++i){
    scanf("%d",&Heap[i]);
  }   
  for(i=1;i<=num;++i){
    printf("node %d: key = %d, ",i,Heap[i]);
    if(parent(i) >= 1)
      printf("parent key = %d, ",Heap[parent(i)]);
    if(left(i) <= num)
      printf("left key = %d, ",Heap[left(i)]);
    if(right(i) <= num)
      printf("right key = %d, ",Heap[right(i)]);
    printf("\n");
  }
    
  return 0;
}
