#include <stdio.h>
#define MAX 100000

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 i,n;
  int heap[MAX];
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&heap[i]);
  
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(parent(i)>=1)printf("parent key = %d, ",heap[parent(i)]);
    if(left(i)<=n)printf("left key = %d, ",heap[left(i)]);
    if(right(i)<=n)printf("right key = %d, ",heap[right(i)]);
    printf("\n");
  }
  
  return 0;
}

