#include<stdio.h>
 
#define H 250
int main(){

  int i, j, id, n;
  int A[H];

  scanf("%d",&n);

  for(i = 1 ; i <= n ; i++){
    scanf("%d",&A[i]);
  }

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

  return 0;
}