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

