#include<stdio.h>
#include<stdlib.h>


int p(int x)
{
  return x/2;
}

int r(int x)
{
  return x*2+1;
}

int l(int x)
{
  return x*2;
}


int main(){
  int A[200005],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(p(i+1)>=1){
      printf("parent key = %d, ",A[p(i+1)]);
    }
    if(l(i+1)<=n){
      printf("left key = %d, ",A[l(i+1)]);
    }
    if(r(i+1)<=n){
      printf("right key = %d, ",A[r(i+1)]);
    }
    printf("\n");
  }
  return 0;
}

