#include<stdio.h>

#define H 250
#define NIL -1
/*
struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
}
*/

int main(){
  int i,j,n;
  int A[H];
  scanf("%d",&n);
  for(i=0;i<=n;i++){
    A[i]=NIL;
  }
  
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d,",i,A[i]);
    if(A[i/2]!=NIL){
     printf(" parent key = %d,",A[i/2]);
    }
    if(i*2<=n && A[i*2]!=NIL){
      printf(" left key = %d,",A[i*2]);    
    }  
    if(i*2+1<=n && A[i*2+1]!=NIL){
      printf(" right key = %d,",A[i*2+1]); 
    }
    printf("\n");
  }
  return 0;
}