#include<stdio.h>

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

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

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

int main(){
  int A[200001],n,i;

  scanf("%d",&n);

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


      printf("\n");
  }
  return 0;
}
