#include<stdio.h>
#define N 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(void){
  int i,n,T[N];

  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    scanf("%d",&T[i]);
  }
 
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,T[i]);
    if(T[Parent(i)]!=NULL)printf("parent key = %d, ",T[Parent(i)]);
    if(T[Left(i)]!=NULL)printf("left key = %d, ",T[Left(i)]);
    if(T[Right(i)]!=NULL)printf("right key = %d, ",T[Right(i)]);
    printf("\n");
  }
  
  return 0;

}